Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ManagedMethod(MyStruct[] items) {
- foreach (var item in items) {
- unmanagedHandle.ProcessOne(item);
- }
- }
- void ManagedMethod(MyStruct[] items) {
- unmanagedHandle.ProcessMany(items, items.Count);
- }
- // What you have
- public struct X
- {
- public int data;
- }
- [DllImport("mylib.dll")]
- static extern void Foo( ref X arg);
- // What you could do
- [StructLayout(LayoutKind.Sequential)]
- public class Y
- {
- public int data;
- }
- [DllImport("mylib.dll")]
- static extern void Bar( Y arg );
Add Comment
Please, Sign In to add comment