May 2010
Intermediate to advanced
1272 pages
61h 18m
English
You can optimize structures’ efficiency with a little bit of work. This work is related to the order that you implement members within a structure. For example, consider the following code:

Notice the order how members are exposed. Because of their memory allocation in bytes, it’s preferable to expose members in the order of bytes they require. With that said, this is a revisited, more efficient version of the structure:

If you are in doubt, don’t worry. The .NET Framework offers an interesting attribute named StructLayout ...
Read now
Unlock full access