Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/standard/native-interop/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The guidance in this section applies to all interop scenarios.

- ✔️ DO use `[LibraryImport]`, if possible, when targeting .NET 7+.
- There are cases when using `[DllImport]` is appropriate. A code analyzer with ID [SYSLIB1054](../../fundamentals/syslib-diagnostics/syslib1050-1069.md) tells you when that's the case.
- ✔️ DO define P/Invoke signatures that match the C export's argument count and use types that accurately represent each native type.
- ✔️ DO use the same naming and capitalization for your methods and parameters as the native method you want to call.
- ✔️ CONSIDER using the same naming and capitalization for constant values.
- ✔️ DO use .NET types that map closest to the native type. For example, in C#, use `uint` when the native type is `unsigned int`.
Expand Down
Loading