c# - StructLayout only for struct? -
I have seen that we have some such places that we have something:
[StructLayout (LayoutKind.Sequential, Pack = 1)] Category classification with public class E2H_LANEFIND_DATA_T {....}
StructLayout
. Is it OK or Structured Layout
for struct
It is clearly stated:
You can apply this attribute to sections or structures.
Generally, the Common Language Runtime controls the physical layout. However, if you want to arrange a class or structure in a certain way in the managed memory, if you want to arrange the class or structure in a certain way, then you can use StructLayoutAttribute You can use. The clear control of the class layout is important if the class is to pass with unmanaged code which expects a particular layout.
The emphasis was mine.
The main idea to make this situation is that do you want your examples to be passed by value or context, in which case you will use a structure or class respectively.
Comments
Post a Comment