/// <summary> /// Marshal object. /// </summary> /// <param name="val">Value.</param> /// <returns>Serialized data as byte array.</returns> public byte[] Marshal <T>(T val) { BinaryHeapStream stream = new BinaryHeapStream(128); Marshal(val, stream); return(stream.GetArrayCopy()); }