Structures With Value Type Members

You want to create a data structure with a few value type members. How should you proceed?

Choose a structure in this scenario. This type is ideal when you have a few members, and all are value types.

This technique proves very effective if you plan on creating arrays of these objects. Structures perform well. They don’t take memory from the managed heap and reduce the number of garbage collections. Arrays of structures take adjacent memory locations. They need only a single memory allocation operation which releases faster. Finally, they perform better because their elements fit into the CPU’s secondary cache.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s