CSharpTest.Net
RawBytes Field
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Serialization Namespace > BytesSerializer Class : RawBytes Field

Glossary Item Box

Gets a singleton of the BytesSerializer class

Syntax

Visual Basic (Declaration) 
Public Shared ReadOnly RawBytes As ISerializer(Of Byte())
C# 
public static readonly ISerializer<byte[]> RawBytes

Example

Library/Library.Test/TestPrimitiveSerializer.cs

C#Copy Code
byte[] bytes = new byte[256];
_random.NextBytes(bytes);

using (MemoryStream ms = new MemoryStream())
{
    BytesSerializer.RawBytes.WriteTo(bytes, ms);
    ms.Position = 0;
    Assert.AreEqual(bytes, BytesSerializer.RawBytes.ReadFrom(ms));
}
VB.NETCopy Code
Dim bytes As Byte() = New Byte(256) {}
_random.NextBytes(bytes)

Using ms As New MemoryStream()
    BytesSerializer.RawBytes.WriteTo(bytes, ms)
    ms.Position = 0
    Assert.AreEqual(bytes, BytesSerializer.RawBytes.ReadFrom(ms))
End Using

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys