private static void Main(String[] args) { // Create your object var input = new POCO { Cake = true, Vegetable = false, Sub = new SubPOCO { SubValue = true } }; // Serialize like you normally would var payload = LightWeight.Serialize(input); // Use the outputted byte array Console.WriteLine(BitConverter.ToString(payload)); // Deserialize like you normally would var output = LightWeight.Deserialize <POCO>(payload); }
/// <summary> /// Deserialize an object from a byte array. /// </summary> public static T Deserialize <T>(Byte[] payload) { var lw = new LightWeight(); return(lw.Decode <T>(payload)); }
/// <summary> /// Serialize an object into a byte array. /// </summary> public static Byte[] Serialize <T>(T value) { var lw = new LightWeight(); return(lw.Encode(value)); }