struct-vs-class

Enumerator Implementation: Use struct or class?

I noticed that List<T> defines its enumerator as a struct, while ArrayList defines its enumerator as a class. What's the difference? If I am to write an enumerator for my class, which one would be preferable? EDIT: My requirements cannot be fulfilled using yield, so I'm implementing an enumerator of my own. That said, I wonder whether i...

When are structs the answer?

I'm doing a raytracer hobby project, and originally I was using structs for my Vector and Ray objects, and I thought a raytracer was the perfect situation to use them: you create millions of them, they don't live longer than a single method, they're lightweight. However, by simply changing 'struct' to 'class' on Vector and Ray, I got a v...

What is the difference, usage-wise, between defines/macros/structs and consts/funcs/classes? (C++)

I know that the difference between defines and constants is that constants have type, and that between macros and functions, functions are called, and typed, whereas macros are untyped inline. Not so much the difference between structs and classes, but I don't think there is one, besides the public/private default thing (and I'm taking ...

C#: Use Class or Struct for simple Types

Possible Duplicate: C# / .NET : when structures are better than classes? Given the following type class Person { public int Id{get;} public Name Name{get;set;} public Address Address{get;set;} } public struct Name { public string First{get;set;} public string Middle{get;set;} public string Last{get;se...