public static void AppendStruct <T>(MemoryObject mo, int size, T s) where T : struct { using (MemoryAlloc data = new MemoryAlloc(size)) { data.WriteStruct(s); mo.AppendData(data.ReadBytes(data.Size)); } }
public static void AppendStruct <T>(MemoryObject mo, T s) where T : struct { using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(T)))) { data.WriteStruct <T>(s); mo.AppendData(data.ReadBytes(data.Size)); } }