I also love the extension methods, lambda expressions, anonymous types and object initializers (examples below). But I'd really love to see optional parameters (like in VB.NET) someday. Oh well, the rest is cool enough for now. The only thing I haven't touched yet is Linq, which I'll be doing sometime soon I hope.
- Extension methods:
public static bool IsGuid(this string s)
{
// TODO: Add logic here, of course.
return true;
}
From then on you can simply do:
string test = "NotAGuid";
if (test.IsGuid())
{
....
} - Anonymous types:
var someObject = new { Name="Lobo", Profession="Sheriff", Salary=15500 }, - Object initializers:
Point point = new Point { X=15, Y=14 };