diff --git a/Modules.Language/Utils.vb b/Modules.Language/Utils.vb index c7cda3b6..d619ef7f 100644 --- a/Modules.Language/Utils.vb +++ b/Modules.Language/Utils.vb @@ -22,6 +22,24 @@ Public Class Utils Return [Enum].Parse(GetType(T), value) End Function + ''' + ''' Converts an Integer value to the given Enum + ''' + ''' The Enum Type + ''' The integer value to convert + Public Shared Function ToEnum(Of T)(value As Integer) As T + Return [Enum].ToObject(GetType(T), value) + End Function + + ''' + ''' Converts a Long value to the given Enum + ''' + ''' The Enum Type + ''' The long value to convert + Public Shared Function ToEnum(Of T)(value As Long) As T + Return [Enum].ToObject(GetType(T), value) + End Function + Public Shared Function ToBoolean(input As String) As Boolean If String.IsNullOrEmpty(input) Then Return False Return (input.Trim().ToLower() = "true") OrElse (input.Trim() = "1")