Visual Basic (Declaration) | |
---|---|
Public Overloads Shared Function DecodeBytes( _ ByVal input As String _ ) As Byte() |
Parameters
- input
Library/Library.Test/TestHexEncoding.cs
C# | Copy Code |
---|---|
const string hex = "01-0203-0405\t0607\r\n0809\r0a0b0c\n0d0e0f10 "; byte[] bin = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; Assert.AreEqual(0, BinaryComparer.Compare(bin, HexEncoding.DecodeBytes(hex))); Assert.AreEqual(0, BinaryComparer.Compare(bin, HexEncoding.DecodeBytes(Encoding.ASCII.GetBytes(hex)))); |
VB.NET | Copy Code |
---|---|
Const hex As String = "01-0203-0405" & vbTab & "0607" & vbCr & vbLf & "0809" & vbCr & "0a0b0c" & vbLf & "0d0e0f10 " Dim bin As Byte() = New Byte() {1, 2, 3, 4, 5, 6, _ 7, 8, 9, 10, 11, 12, _ 13, 14, 15, 16} Assert.AreEqual(0, BinaryComparer.Compare(bin, HexEncoding.DecodeBytes(hex))) Assert.AreEqual(0, BinaryComparer.Compare(bin, HexEncoding.DecodeBytes(Encoding.ASCII.GetBytes(hex)))) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
HexEncoding ClassHexEncoding Members
Overload List