Stats

60 Contributors: 2 Wednesday, August 10, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Platform Invoke

Syntax

  • [DllImport("Example.dll")] static extern void SetText(string inString);
  • [DllImport("Example.dll")] static extern void GetText(StringBuilder outString);
  • [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] string text;
  • [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] byte[] byteArr;
  • [StructLayout(LayoutKind.Sequential)] public struct PERSON {...}
  • [StructLayout(LayoutKind.Explicit)] public struct MarshaledUnion { [FieldOffset(0)]... }

Related Examples