BinarySerialization Class
Namespace: Stride.Core.SerializationAssembly: Stride.Core.dll
Binary serialization method helpers to easily read/write data from a stream.
public class BinarySerialization
Remarks
This class is a simple front end to BinarySerializationReader and BinarySerializationWriter.
| Name | Description | |
|---|---|---|
| Methods | ||
| Read<T>(Byte[]) | Reads an object instance from the specified byte buffer. |
|
| Read<T>(Stream) | Reads an object instance from the specified stream. |
|
| Write<T>(Stream, T) | Writes an object instance to the specified stream. |
|
Methods
Read<T>(Byte[])
Reads an object instance from the specified byte buffer.
public static T Read<T>(byte[] buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | buffer | The byte buffer to read the object instance. |
Returns
| Type | Description |
|---|---|
| T | An object instance of type T. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the object to read |
Read<T>(Stream)
Reads an object instance from the specified stream.
public static T Read<T>(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream to read the object instance. |
Returns
| Type | Description |
|---|---|
| T | An object instance of type T. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the object to read |
Write<T>(Stream, T)
Writes an object instance to the specified stream.
public static void Write<T>(Stream stream, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream to write the object instance to. |
| T | value | The value to write. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the object to write |