public T Decode <T>(ArraySegment <Byte> input) { #if DEBUG if (null == input) { throw new ArgumentNullException(nameof(input)); } #endif // Assume root is a class var coder = new HeliumClass(0, false); coder.Prepare(typeof(T)); // Invoke root serializer var value = coder.Decode(new DecodeBuffer(input)); return((T)value); }
public Byte[] Encode <T>(T value) { #if DEBUG if (null == value) { throw new ArgumentNullException(nameof(value)); } #endif // Assume root is a class var coder = new HeliumClass(0, false); coder.Prepare(typeof(T)); // Invoke coder var output = coder.Encode(value); // Flattern into to byte array return(output.Flattern()); }