While browsing through MSDN blogs I came across this nice little post.
http://blogs.msdn.com/dparys/archive/2008/10/28/neue-m-glichkeiten-in-c-4-0.aspx . After translating the page I found that he linked to the new C# 40 page
http://code.msdn.microsoft.com/csharpfutureI played around with VS 2010 last night. I was able to test the dynamic keyword. It works as advertised but the biggest thing one has to realize is using it removes intellisense for that variable. Compiling type safety as well. I hope they'll be able to add some sort of limited intellisense by looking at the last assigned type.
Also on the Dynamic front is DynamicObject. A new base object type that allows for on the fly Property declaration. The DynamicObject uses a PropertyBag (looks like a Dictionary<string,object>). You can declare properties on the fly. Like
public class MyBag : DynamicObject
{
// überschreibt Getter / Setter
}
dynamic b = new MyBag();
b.Id = 124;
b.Name = "Windows 7"
b.Price = 499.99m;
b.IsAvailable = false;
One thing I was unable to figure out was the optional, default and named parameters. Again the blog provided some answers.
public void InsertCustomer( int customerId,
string companyName = "Neue Firma",
decimal creditLimit = 2000m )
{
}
InsertCustomer( 1, creditLimit: 2000m );
InsertCustomer( creditLimit: 2000m, customerId: 1 );