Method Deserialize
Deserialize(string, CancellationToken)
Deserializes the binary data from the specified file path into a DataSource instance using the provided model for context.
public static DataSource Deserialize(string dataSourcePath, CancellationToken cancellationToken = default)
Parameters
dataSourcePath
stringThe path to the binary file containing the serialized DataSource. The path must not be null or empty, and the file should be in a valid binary format produced by a corresponding serialization method.
cancellationToken
CancellationTokenA token to monitor for cancellation requests. The default value is None.
Returns
- DataSource
A new instance of DataSource reconstructed from the provided binary data.
Exceptions
- ArgumentNullException
Thrown if
dataSourcePath
is null or empty.- FileNotFoundException
Thrown if the file specified by
dataSourcePath
does not exist.
Deserialize(byte[], CancellationToken)
Deserializes the given binary data into a DataSource instance using the specified model for context.
public static DataSource Deserialize(byte[] data, CancellationToken cancellationToken = default)
Parameters
data
byte[]The binary data representing a serialized DataSource. This data must not be null and should be in a valid binary format produced by a corresponding serialize method.
cancellationToken
CancellationTokenA token to monitor for cancellation requests. The default value is None.
Returns
- DataSource
A new instance of DataSource reconstructed from the provided binary data.
Deserialize(Stream, CancellationToken)
Deserializes a DataSource from a stream using the provided model for context.
public static DataSource Deserialize(Stream stream, CancellationToken cancellationToken = default)
Parameters
stream
StreamThe stream containing the binary data of a serialized DataSource. The stream must be readable and must not be null.
cancellationToken
CancellationTokenA token to monitor for cancellation requests. The default value is None.
Returns
- DataSource
A new instance of DataSource reconstructed from the data in the stream.
Exceptions
- ArgumentException
Thrown if the stream is not readable.
- InvalidDataException
Thrown when the data in the stream does not represent a valid serialized DataSource, or if errors occur during the deserialization process.