Class SerializationHelper
public static class SerializationHelper
- Inheritance
-
SerializationHelper
- Inherited Members
Methods
Deserialize<T>(byte[])
Deserializes an object to a given T type.
public static T Deserialize<T>(byte[] bytes)
Parameters
bytesbyte[]The byte array representing a
Tobject.
Returns
- T
A
Tobject.
Type Parameters
TGeneric type parameter.
Exceptions
- FormatException
Thrown when the format of the byte array is incorrect.
Deserialize<T>(Stream)
Deserializes an object to a given T type.
public static T Deserialize<T>(Stream stream)
Parameters
streamStreamThe steam.
Returns
- T
A
Tobject.
Type Parameters
TGeneric type parameter.
Exceptions
- FormatException
Thrown when the format of an input is incorrect.
Deserialize<T>(string)
Deserializes a JSON encoded string to the given T.
public static T Deserialize<T>(string str)
Parameters
strstringThe
JSONencoded string representing aTobject.
Returns
- T
A
Tobject.
Type Parameters
TGeneric type parameter.
SerializeToBytes(object)
Serializes an object to a byte array.
public static byte[] SerializeToBytes(object obj)
Parameters
objobjectThe object.
Returns
- byte[]
A
JSONencoded string.
SerializeToString(object)
Serializes an object to a JSON encoded string.
public static string SerializeToString(object obj)
Parameters
objobjectThe object.
Returns
- string
A
JSONencoded string.