Structures and Classes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For the most part, I use classes but when I'm trying to figure exactly when I
should use structures.

- Should I use a structure when I know it will contain a lot of code?
- Should I use a structure when it will hold references to other classes?

When is the right time to use a structure?
 
I'd recommend the following articles:

"Writing Faster Managed Code: Know What Things Cost" - .NET Development
Technical Articles
".NET: Type Fundamentals" - MSDN Magazine December 2000
"Objects and Values" - MSDN Magazine June 2002, October 2002
 
Structures are value types, classes are reference types.
Structures are generally for storing values (a type that exists mainly to
read/write property values for example).
Classes are generally for types that have more functionality in them (types
that have many events/methods for example).
Structures are generally for user defined types.
 
Back
Top