Skip to content

Commit

Permalink
Update passing-structures.md
Browse files Browse the repository at this point in the history
Fix missing whitespace.

(Spotted while looking at https://learn.microsoft.com/en-us/dotnet/framework/interop/passing-structures; the missing space made the sentence unnecessary hard to understand, since it almost looked like a `variable.Property` declaration)
  • Loading branch information
perlun authored Mar 1, 2025
1 parent 38bff04 commit 03426fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/framework/interop/passing-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ms.assetid: 9b92ac73-32b7-4e1b-862e-6d8d950cf169

Many unmanaged functions expect you to pass, as a parameter to the function, members of structures (user-defined types in Visual Basic) or members of classes that are defined in managed code. When passing structures or classes to unmanaged code using platform invoke, you must provide additional information to preserve the original layout and alignment. This topic introduces the <xref:System.Runtime.InteropServices.StructLayoutAttribute> attribute, which you use to define formatted types. For managed structures and classes, you can select from several predictable layout behaviors supplied by the **LayoutKind** enumeration.

Central to the concepts presented in this topic is an important difference between structure and class types. Structures are value types and classes are reference types — classes always provide at least one level of memory indirection (a pointer to a value). This difference is important because unmanaged functions often demand indirection, as shown by the signatures in the first column of the following table. The managed structure and class declarations in the remaining columns show the degree to which you can adjust the level of indirection in your declaration.Declarations are provided for both Visual Basic and Visual C#.
Central to the concepts presented in this topic is an important difference between structure and class types. Structures are value types and classes are reference types — classes always provide at least one level of memory indirection (a pointer to a value). This difference is important because unmanaged functions often demand indirection, as shown by the signatures in the first column of the following table. The managed structure and class declarations in the remaining columns show the degree to which you can adjust the level of indirection in your declaration. Declarations are provided for both Visual Basic and Visual C#.

|Unmanaged signature|Managed declaration: <br />no indirection<br />`Structure MyType`<br />`struct MyType;`|Managed declaration: <br />one level of indirection<br />`Class MyType`<br />`class MyType;`|
|-------------------------|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
Expand Down

0 comments on commit 03426fe

Please sign in to comment.