Thursday, June 24, 2010

C# tip - 6/24/2010

Value types versus Reference types:

  • structs
    • created on the stack
    • not polymorphic
    • memory efficient
    • not inheritable
    • used mostly for data storage
  • classes
    • created references on the heap
    • polymorphic
    • inheritable
    • define behavior
Use structs for simple objects that are just data containers.
Use classes for any objects that perform work.

No comments:

Labels