Auto-Implemented Properties and Object Initializers
I just started learning about Orcas, so for those of you not yet into it, check this out:
Notice this is a class, not an interface. These are auto-implemented properties:
public class Student
{
public string First { get; set; }
public string Last { get; set; }
public int ID { get; set; }
public int[] Scores;
}
Given the above, the Student class now has read-write properties (yes you can mark the "set" as private and get read-only that way). Use them as you would any other:
Student s = new Student();
s.First = "Anton";
But the real convenience is when you combine those with Object Initializers:
Student s = new Student // object init
{
First = "Anton",
Last = "Delsink"
};
How cool is that! Demo heaven :)