Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Updating broken link and wording from updated docs
Source Link
heavyd
  • 17.8k
  • 5
  • 59
  • 76

Some additional information followup regarding @Rytmis's post.

From https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/interop-pinvokes.mdhttps://learn.microsoft.com/en-us/dotnet/standard/native-interop/best-practices#guids:


Guids are usable directly in signatures. When passed by ref they can either be passed by ref or with theDO NOT Use [MarshalAs(UnmanagedType.LPStruct)] attribute.

[MarshalAs(UnmanagedType.LPStruct)] should only be used for byanything other than ref GuidsGUID parameters.

Some additional information followup regarding @Rytmis's post.

From https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/interop-pinvokes.md:


Guids are usable directly in signatures. When passed by ref they can either be passed by ref or with the [MarshalAs(UnmanagedType.LPStruct)] attribute.

[MarshalAs(UnmanagedType.LPStruct)] should only be used for by ref Guids.

Some additional information followup regarding @Rytmis's post.

From https://learn.microsoft.com/en-us/dotnet/standard/native-interop/best-practices#guids:


DO NOT Use [MarshalAs(UnmanagedType.LPStruct)] for anything other than ref GUID parameters.

Source Link
Joseph Lennox
  • 3.3k
  • 1
  • 29
  • 25

Some additional information followup regarding @Rytmis's post.

From https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/interop-pinvokes.md:


Guids are usable directly in signatures. When passed by ref they can either be passed by ref or with the [MarshalAs(UnmanagedType.LPStruct)] attribute.

[MarshalAs(UnmanagedType.LPStruct)] should only be used for by ref Guids.