Possible Duplicate:
Struct v/s Class in C# - Please explain the behavior.
I am confused that have seen often that we create custom object by following
public class Student { public string Name{get;set;} public string Class{get;set;} public string Section{get;set;} } and create instant and use its attributes as property for example
List<Student> absentUsers = new List<Students>(); Student studenttoadd = new Student();//Object studenttoadd.Name = "You"; studenttoadd.Class = "PlayGroup"; absentUsers.Add(studenttoadd); and so on
but isn't it true that we can do same with Struct?
What is mentioned approach called(example i have given)?
When to Use this approach and when to use struct?
is there any performance /memory allocation difference?
structhere. A common mistake for people from C++ etc, but a mistake.