Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region "Conversions"
- Public Function [Boolean](ByVal lpValue() As Byte) As Boolean
- Return BitConverter.ToBoolean(lpValue, 0)
- End Function
- Public Function [Boolean](ByVal bValue As Boolean) As Byte()
- Return BitConverter.GetBytes(bValue)
- End Function
- Public Function [Byte](ByVal lpValue() As Byte) As Byte
- Return lpValue(0)
- End Function
- Public Function [Byte](ByVal dwValue As Byte) As Byte()
- Return BitConverter.GetBytes(dwValue)
- End Function
- Public Function [Char](ByVal lpValue() As Byte) As Char
- Return BitConverter.ToChar(lpValue, 0)
- End Function
- Public Function [Char](ByVal cValue As Char) As Byte()
- Return BitConverter.GetBytes(cValue)
- End Function
- Public Function [Double](ByVal lpValue() As Byte) As Double
- Return BitConverter.ToDouble(lpValue, 0)
- End Function
- Public Function [Double](ByVal dblValue As Double) As Byte()
- Return BitConverter.GetBytes(dblValue)
- End Function
- Public Function [Int16](ByVal lpValue() As Byte) As Int16
- Return BitConverter.ToInt16(lpValue, 0)
- End Function
- Public Function [Int16](ByVal nValue As Int16) As Byte()
- Return BitConverter.GetBytes(nValue)
- End Function
- Public Function [Int32](ByVal lpValue() As Byte) As Int32
- Return BitConverter.ToInt32(lpValue, 0)
- End Function
- Public Function [Int32](ByVal nValue As Int32) As Byte()
- Return BitConverter.GetBytes(nValue)
- End Function
- Public Function [Int64](ByVal lpValue() As Byte) As Int64
- Return BitConverter.ToInt64(lpValue, 0)
- End Function
- Public Function [Int64](ByVal nValue As Int64) As Byte()
- Return BitConverter.GetBytes(nValue)
- End Function
- Public Function [Integer](ByVal lpValue() As Byte) As Integer
- Return [Int32](lpValue)
- End Function
- Public Function [Integer](ByVal nValue As Integer) As Byte()
- Return [Int32](nValue)
- End Function
- Public Function [Long](ByVal lpValue() As Byte) As Long
- Return [Int64](lpValue)
- End Function
- Public Function [Long](ByVal nValue As Long) As Byte()
- Return [Int64](nValue)
- End Function
- Public Function [Short](ByVal lpValue() As Byte) As Short
- Return [Int16](lpValue)
- End Function
- Public Function [Short](ByVal nValue As Short) As Byte()
- Return [Int16](nValue)
- End Function
- Public Function [Single](ByVal lpValue() As Byte) As Single
- Return BitConverter.ToSingle(lpValue, 0)
- End Function
- Public Function [Single](ByVal flValue As Single) As Byte()
- Return BitConverter.GetBytes(flValue)
- End Function
- Public Function [String](ByVal lpValue() As Byte) As String
- Return [ASCII](lpValue)
- End Function
- Public Function [String](ByVal strValue As String) As Byte()
- Return [ASCII](strValue)
- End Function
- Public Function [ASCII](ByVal lpValue() As Byte) As String
- Return Text.Encoding.ASCII.GetString(lpValue)
- End Function
- Public Function [ASCII](ByVal strValue As String) As Byte()
- Dim lpValue() As Byte = Text.Encoding.ASCII.GetBytes(strValue)
- ReDim Preserve lpValue(Text.Encoding.ASCII.GetBytes(strValue).Length)
- Return lpValue
- End Function
- Public Function [Unicode](ByVal lpValue() As Byte) As String
- Return Text.Encoding.Unicode.GetString(lpValue)
- End Function
- Public Function [Unicode](ByVal strValue As String) As Byte()
- Dim lpValue() As Byte = Text.Encoding.Unicode.GetBytes(strValue)
- ReDim Preserve lpValue(Text.Encoding.Unicode.GetBytes(strValue).Length)
- Return lpValue
- End Function
- Public Function [UInt16](ByVal lpValue() As Byte) As UInt16
- Return BitConverter.ToUInt16(lpValue, 0)
- End Function
- Public Function [UInt16](ByVal dwValue As UInt16) As Byte()
- Return BitConverter.GetBytes(dwValue)
- End Function
- Public Function [UInt32](ByVal lpValue() As Byte) As UInt32
- Return BitConverter.ToUInt32(lpValue, 0)
- End Function
- Public Function [UInt32](ByVal dwValue As UInt32) As Byte()
- Return BitConverter.GetBytes(dwValue)
- End Function
- Public Function [UInt64](ByVal lpValue() As Byte) As UInt64
- Return BitConverter.ToUInt64(lpValue, 0)
- End Function
- Public Function [UInt64](ByVal dwValue As UInt64) As Byte()
- Return BitConverter.GetBytes(dwValue)
- End Function
- Public Function [UInteger](ByVal lpValue() As Byte) As UInteger
- Return [UInt32](lpValue)
- End Function
- Public Function [UInteger](ByVal dwValue As UInteger) As Byte()
- Return [UInt32](dwValue)
- End Function
- Public Function [ULong](ByVal lpValue() As Byte) As ULong
- Return [UInt64](lpValue)
- End Function
- Public Function [ULong](ByVal dwValue As ULong) As Byte()
- Return [UInt64](dwValue)
- End Function
- Public Function [UShort](ByVal lpValue() As Byte) As UShort
- Return [UInt16](lpValue)
- End Function
- Public Function [UShort](ByVal dwValue As UShort) As Byte()
- Return [UInt16](dwValue)
- End Function
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement