Class ISerializerExtensions
- Namespace
- Ecng.Serialization
- Assembly
- Ecng.Serialization.dll
Provides extension methods for the ISerializer and ISerializer<T> interfaces to support serialization and deserialization operations with files, streams, and byte arrays.
public static class ISerializerExtensions
- Inheritance
-
ISerializerExtensions
- Inherited Members
Methods
Deserialize(ISerializer, byte[])
Deserializes the specified byte array into an object.
public static object Deserialize(this ISerializer serializer, byte[] data)
Parameters
serializerISerializerThe serializer instance.
databyte[]The byte array containing the serialized data.
Returns
- object
The deserialized object.
Deserialize(ISerializer, Stream)
Deserializes the data from the given stream into an object.
public static object Deserialize(this ISerializer serializer, Stream stream)
Parameters
serializerISerializerThe serializer instance.
streamStreamThe stream containing the serialized data.
Returns
- object
The deserialized object.
Deserialize<T>(ISerializer<T>, byte[])
Deserializes the specified byte array into an object of type T.
public static T Deserialize<T>(this ISerializer<T> serializer, byte[] data)
Parameters
serializerISerializer<T>The serializer instance.
databyte[]The byte array containing the serialized data.
Returns
- T
An object of type T.
Type Parameters
TThe type of object to deserialize.
Deserialize<T>(ISerializer<T>, Stream)
Deserializes the data from the given stream into an object of type T.
public static T Deserialize<T>(this ISerializer<T> serializer, Stream stream)
Parameters
serializerISerializer<T>The serializer instance.
streamStreamThe stream containing the serialized data.
Returns
- T
An object of type T.
Type Parameters
TThe type of object to deserialize.
Deserialize<T>(ISerializer<T>, string)
Deserializes the data from the specified file into an object of type T.
public static T Deserialize<T>(this ISerializer<T> serializer, string fileName)
Parameters
serializerISerializer<T>The serializer instance.
fileNamestringThe path of the file to read from.
Returns
- T
An object of type T.
Type Parameters
TThe type of object to deserialize.
Serialize(ISerializer, object)
Serializes the specified object graph and returns the result as a byte array.
public static byte[] Serialize(this ISerializer serializer, object graph)
Parameters
serializerISerializerThe serializer instance.
graphobjectThe object graph to serialize.
Returns
- byte[]
A byte array containing the serialized data.
Serialize(ISerializer, object, Stream)
Serializes the specified object graph and writes the output to the provided stream.
public static void Serialize(this ISerializer serializer, object graph, Stream stream)
Parameters
serializerISerializerThe serializer instance.
graphobjectThe object graph to serialize.
streamStreamThe stream to which to write the serialized data.
Serialize(ISerializer, object, string)
Serializes the specified object graph and writes the output to a file.
public static void Serialize(this ISerializer serializer, object graph, string fileName)
Parameters
serializerISerializerThe serializer instance.
graphobjectThe object graph to serialize.
fileNamestringThe path of the file to write to.