MSDN says that you should use structs when you need lightweight objects. Are there any other scenarios when a struct is preferable over a class?
Some people might ha
Bill Wagner has a chapter about this in his book "effective c#" (http://www.amazon.com/Effective-Specific-Ways-Improve-Your/dp/0321245660). He concludes by using the following principle:
- Is the main responsability of the type data storage?
- Is its public interface defined entirely by properties that access or modify its data members?
- Are you sure your type will never have subclasses?
- Are you sure your type will never be treated polymorphically?
If you answer 'yes' to all 4 questions: use a struct. Otherwise, use a class.