ISerializerExtensions
Provides extension methods for the ISerializer and ISerializer<T> interfaces to support serialization and deserialization operations with files, streams, and byte arrays.
Métodos
public static object Deserialize(ISerializer serializer, byte[] data)
result = ISerializerExtensions.Deserialize(serializer, data)
Deserializes the specified byte array into an object.
- serializer
- The serializer instance.
- data
- The byte array containing the serialized data.
Devuelve: The deserialized object.
public static object Deserialize(ISerializer serializer, Stream stream)
result = ISerializerExtensions.Deserialize(serializer, stream)
Deserializes the data from the given stream into an object.
- serializer
- The serializer instance.
- stream
- The stream containing the serialized data.
Devuelve: The deserialized object.
public static object Deserialize(ISerializer serializer, IFileSystem fs, string path)
result = ISerializerExtensions.Deserialize(serializer, fs, path)
Deserializes the data from the specified file into an object using the provided file system.
- serializer
- The serializer instance.
- fs
- The file system to use.
- path
- The path of the file to read from.
Devuelve: The deserialized object.
public static ValueTask<object> DeserializeAsync(ISerializer serializer, byte[] data, CancellationToken cancellationToken)
result = ISerializerExtensions.DeserializeAsync(serializer, data, cancellationToken)
Deserializes the specified byte array into an object.
- serializer
- The serializer instance.
- data
- The byte array containing the serialized data.
- cancellationToken
- A token for cancellation.
Devuelve: The deserialized object.
public static ValueTask<object> DeserializeAsync(ISerializer serializer, IFileSystem fs, string path, CancellationToken cancellationToken)
result = ISerializerExtensions.DeserializeAsync(serializer, fs, path, cancellationToken)
Deserializes the data from the specified file into an object using the provided file system.
- serializer
- The serializer instance.
- fs
- The file system to use.
- path
- The path of the file to read from.
- cancellationToken
- A token for cancellation.
Devuelve: The deserialized object.
public static ValueTask<T> DeserializeAsync<T>(ISerializer<T> serializer, IFileSystem fs, string path, CancellationToken cancellationToken)
result = ISerializerExtensions.DeserializeAsync(serializer, fs, path, cancellationToken)
Deserializes the data from the specified file into an object of type T using the provided file system.
- serializer
- The serializer instance.
- fs
- The file system to use.
- path
- The path of the file to read from.
- cancellationToken
- A token for cancellation.
Devuelve: An object of type T.
public static ValueTask<T> DeserializeAsync<T>(ISerializer<T> serializer, byte[] data, CancellationToken cancellationToken)
result = ISerializerExtensions.DeserializeAsync(serializer, data, cancellationToken)
Deserializes the specified byte array into an object of type T.
- serializer
- The serializer instance.
- data
- The byte array containing the serialized data.
- cancellationToken
- A token for cancellation.
Devuelve: An object of type T.
public static T Deserialize<T>(ISerializer<T> serializer, IFileSystem fs, string path)
result = ISerializerExtensions.Deserialize(serializer, fs, path)
Deserializes the data from the specified file into an object of type T using the provided file system.
- serializer
- The serializer instance.
- fs
- The file system to use.
- path
- The path of the file to read from.
Devuelve: An object of type T.
public static T Deserialize<T>(ISerializer<T> serializer, byte[] data)
result = ISerializerExtensions.Deserialize(serializer, data)
Deserializes the specified byte array into an object of type T.
- serializer
- The serializer instance.
- data
- The byte array containing the serialized data.
Devuelve: An object of type T.
public static T Deserialize<T>(ISerializer<T> serializer, Stream stream)
result = ISerializerExtensions.Deserialize(serializer, stream)
Deserializes the data from the given stream into an object of type T.
- serializer
- The serializer instance.
- stream
- The stream containing the serialized data.
Devuelve: An object of type T.
public static void Serialize(ISerializer serializer, object graph, IFileSystem fs, string path)
ISerializerExtensions.Serialize(serializer, graph, fs, path)
Serializes the specified object graph and writes the output to a file using the provided file system.
- serializer
- The serializer instance.
- graph
- The object graph to serialize.
- fs
- The file system to use.
- path
- The path of the file to write to.
public static byte[] Serialize(ISerializer serializer, object graph)
result = ISerializerExtensions.Serialize(serializer, graph)
Serializes the specified object graph and returns the result as a byte array.
- serializer
- The serializer instance.
- graph
- The object graph to serialize.
Devuelve: A byte array containing the serialized data.
public static void Serialize(ISerializer serializer, object graph, Stream stream)
ISerializerExtensions.Serialize(serializer, graph, stream)
Serializes the specified object graph and writes the output to the provided stream.
- serializer
- The serializer instance.
- graph
- The object graph to serialize.
- stream
- The stream to which to write the serialized data.
public static ValueTask SerializeAsync(ISerializer serializer, object graph, IFileSystem fs, string path, CancellationToken cancellationToken)
result = ISerializerExtensions.SerializeAsync(serializer, graph, fs, path, cancellationToken)
Serializes the specified object graph and writes the output to a file using the provided file system.
- serializer
- The serializer instance.
- graph
- The object graph to serialize.
- fs
- The file system to use.
- path
- The path of the file to write to.
- cancellationToken
- A token for cancellation.
Devuelve: ValueTask
public static ValueTask<byte[]> SerializeAsync(ISerializer serializer, object graph, CancellationToken cancellationToken)
result = ISerializerExtensions.SerializeAsync(serializer, graph, cancellationToken)
Serializes the specified object graph and returns the result as a byte array.
- serializer
- The serializer instance.
- graph
- The object graph to serialize.
- cancellationToken
- A token for cancellation.
Devuelve: A byte array containing the serialized data.