Class SerializationHelper
Namespace: CapyKit.Helpers
Assembly: CapyKit.dll
public static class SerializationHelper
Inheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Extension Methods
ObjectExtensions.UpdateProperties(object, object)
Methods
Deserialize<T>(byte[])
Deserializes an object to a given T type.
public static T Deserialize<T>(byte[] bytes)
Parameters
bytes byte[]
The byte array representing a T object.
Returns
T
A T object.
Type Parameters
T
Generic type parameter.
Exceptions
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
stream Stream
The steam.
Returns
T
A T object.
Type Parameters
T
Generic type parameter.
Exceptions
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
str string
The JSON encoded string representing a T object.
Returns
T
A T object.
Type Parameters
T
Generic type parameter.
SerializeToBytes(object)
Serializes an object to a byte array.
public static byte[] SerializeToBytes(object obj)
Parameters
obj object
The object.
Returns
byte[]
A JSON encoded string.
SerializeToString(object)
Serializes an object to a JSON encoded string.
public static string SerializeToString(object obj)
Parameters
obj object
The object.
Returns
A JSON encoded string.