CSharpTest.Net
DecodeBytes(String) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > AsciiEncoder Class > DecodeBytes Method : DecodeBytes(String) Method

data

Glossary Item Box

Returns the original byte array provided when the encoding was performed

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function DecodeBytes( _
   ByVal data As String _
) As Byte()
C# 
public static byte[] DecodeBytes( 
   string data
)

Parameters

data

Example

Library/Library.Test/TestSafe64Encoding.cs

C#Copy Code
//char count must by multiple of 4 for the compare to work
string encoded = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
byte[] data = Safe64Encoding.DecodeBytes(encoded);
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(encoded);
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded));
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data));
VB.NETCopy Code
'char count must by multiple of 4 for the compare to work
Dim encoded As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
Dim data As Byte() = Safe64Encoding.DecodeBytes(encoded)
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(encoded)
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded))
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys