Class Serializer
Model serializer. Can be used to serialize and deserialize (i.e. save and
load) models from the framework to and from the disk and other streams.
Inheritance
System.Object
Serializer
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Mars.IO.dll
Syntax
public static class Serializer
Methods
|
Improve this Doc
View Source
Load<T>(Stream, out T, SerializerCompression)
Loads an object from a stream.
Declaration
public static T Load<T>(Stream stream, out T value, SerializerCompression compression = SerializerCompression.None)
Parameters
Type |
Name |
Description |
System.IO.Stream |
stream |
The stream from which the object is to be deserialized. |
T |
value |
The object to be read. This parameter can be used to avoid the
need of specifying a generic argument to this function.
|
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Returns
Type |
Description |
T |
The deserialized machine. |
Type Parameters
|
Improve this Doc
View Source
Load<T>(Stream, SerializerCompression)
Loads an object from a stream.
Declaration
public static T Load<T>(Stream stream, SerializerCompression compression = SerializerCompression.None)
Parameters
Type |
Name |
Description |
System.IO.Stream |
stream |
The stream from which the object is to be deserialized. |
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Returns
Type |
Description |
T |
The deserialized machine. |
Type Parameters
|
Improve this Doc
View Source
Load<T>(String, out T, SerializerCompression)
Loads an object from a file.
Declaration
public static T Load<T>(string path, out T value, SerializerCompression compression)
Parameters
Type |
Name |
Description |
System.String |
path |
The path to the file from which the object is to be deserialized. |
T |
value |
The object to be read. This parameter can be used to avoid the
need of specifying a generic argument to this function.
|
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Returns
Type |
Description |
T |
The deserialized object. |
Type Parameters
|
Improve this Doc
View Source
Load<T>(String, out T)
Loads an object from a file.
Declaration
public static T Load<T>(string path, out T value)
Parameters
Type |
Name |
Description |
System.String |
path |
The path to the file from which the object is to be deserialized. |
T |
value |
The object to be read. This parameter can be used to avoid the
need of specifying a generic argument to this function.
|
Returns
Type |
Description |
T |
The deserialized object. |
Type Parameters
|
Improve this Doc
View Source
Load<T>(String, SerializerCompression)
Loads an object from a file.
Declaration
public static T Load<T>(string path, SerializerCompression compression)
Parameters
Type |
Name |
Description |
System.String |
path |
The path to the file from which the object is to be deserialized. |
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Returns
Type |
Description |
T |
The deserialized object. |
Type Parameters
|
Improve this Doc
View Source
Load<T>(String)
Loads an object from a file.
Declaration
public static T Load<T>(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path to the file from which the object is to be deserialized. |
Returns
Type |
Description |
T |
The deserialized object. |
Type Parameters
|
Improve this Doc
View Source
Save<T>(T, out Byte[], SerializerCompression)
Saves an object to a stream.
Declaration
public static void Save<T>(this T obj, out byte[] bytes, SerializerCompression compression = SerializerCompression.None)
Parameters
Type |
Name |
Description |
T |
obj |
The object to be serialized. |
System.Byte[] |
bytes |
The sequence of bytes to which the object has been serialized. |
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Type Parameters
|
Improve this Doc
View Source
Save<T>(T, Stream, SerializerCompression)
Saves an object to a stream.
Declaration
public static void Save<T>(this T obj, Stream stream, SerializerCompression compression = SerializerCompression.None)
Parameters
Type |
Name |
Description |
T |
obj |
The object to be serialized. |
System.IO.Stream |
stream |
The stream to which the object is to be serialized. |
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Type Parameters
|
Improve this Doc
View Source
Saves an object to a stream.
Declaration
public static void Save<T>(this T obj, BinaryFormatter formatter, Stream stream, SerializerCompression compression = SerializerCompression.None)
Parameters
Type |
Name |
Description |
T |
obj |
The object to be serialized. |
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
formatter |
The binary formatter. |
System.IO.Stream |
stream |
The stream to which the object is to be serialized. |
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Type Parameters
|
Improve this Doc
View Source
Save<T>(T, String, SerializerCompression)
Saves an object to a stream.
Declaration
public static void Save<T>(this T obj, string path, SerializerCompression compression)
Parameters
Type |
Name |
Description |
T |
obj |
The object to be serialized. |
System.String |
path |
The path to the file to which the object is to be serialized. |
SerializerCompression |
compression |
The type of compression to use. Default is None. |
Type Parameters
|
Improve this Doc
View Source
Save<T>(T, String)
Saves an object to a stream.
Declaration
public static void Save<T>(this T obj, string path)
Parameters
Type |
Name |
Description |
T |
obj |
The object to be serialized. |
System.String |
path |
The path to the file to which the object is to be serialized. |
Type Parameters