// Method to marshal from managed struct tot native internal unsafe void __MarshalTo(ref __Native @ref) { @ref.Size = this.Size; @ref.ObjectSize = this.ObjectSize; @ref.Flags = this.Flags; @ref.DataSize = this.DataSize; @ref.ObjectArrayCount = 0; @ref.ObjectArrayPointer = IntPtr.Zero; if (ObjectsFormat != null && ObjectsFormat.Length > 0) { @ref.ObjectArrayCount = ObjectsFormat.Length; var nativeDataFormats = new DataObjectFormat.__Native[ObjectsFormat.Length]; for (int i = 0; i < ObjectsFormat.Length; i++) { ObjectsFormat[i].__MarshalTo(ref nativeDataFormats[i]); } var handle = GCHandle.Alloc(nativeDataFormats, GCHandleType.Pinned); @ref.ObjectArrayPointer = handle.AddrOfPinnedObject(); } }
// Method to marshal from managed struct tot native internal unsafe void __MarshalTo(ref __Native @ref) { @ref.Size = this.Size; @ref.ObjectSize = this.ObjectSize; @ref.Flags = this.Flags; @ref.DataSize = this.DataSize; @ref.ObjectArrayCount = 0; @ref.ObjectArrayPointer = IntPtr.Zero; if (ObjectsFormat != null && ObjectsFormat.Length > 0) { @ref.ObjectArrayCount = ObjectsFormat.Length; var nativeDataFormats = new DataObjectFormat.__Native[ObjectsFormat.Length]; for(int i = 0; i < ObjectsFormat.Length; i++ ) ObjectsFormat[i].__MarshalTo(ref nativeDataFormats[i]); var handle = GCHandle.Alloc(nativeDataFormats, GCHandleType.Pinned); @ref.ObjectArrayPointer = handle.AddrOfPinnedObject(); } }