QUOTE(Footsie @ 26 Oct, 2007 - 01:38 AM)

Isn't there a way to force someone to initialize all fields in a class?
Yes, a class constructor can force init parameters. The initialization here refers to nulls:
CODE
int i; // primative
String s; // class
DateTime d; // struct
Here, s is null, both i and d must have some value that's within their scope. I believe i starts with 0 and d might be DateTime.Now. (Sorry, not close to a dev box. )
That you can't have true nulls in non class types is such a bother that a NullObject design pattern is common. Such a pattern is even implicitly implemented in .NET 2.0 with constructs like DateTime ?d, which wraps d in an object for ease of processing.
QUOTE(garima @ 26 Oct, 2007 - 05:46 AM)

A structure would be collection of related data, while a class would be collection of data and code which handles that data.
Problem: in C# structs can have methods! Now how do you explain the difference to a student? Structs have grown to blur the line, which is why they're such a pain to explain.
So, the reason to use these things is the stack? They look like objects to the user, until they are parameters, at which point copies are made and values never returned. Sure, you can use ref and break your OO even more. A careless
list2=list1 will behave quite different for a struct than an object. And not having null is messy.
Using the stack has to be a really big bonus to recommend a struct. But in itself it's a negative, because now I have to think about stack and heap. Even better, it's far far easier to overflow a stack. Of course, even though objects live on the heap, their privative parts will ultimately find their way to the stack for processing. Some of the use the stack argument is lost there.
In an Object Oriented environment, primitives are a required evil. Structs, on the other hand, are an unsavory, ultimately unnecessary, blemish. There are few list processing examples you might come up with which recommend a struct, but I don't believe such C hold overs can really justify the thing's existence.