C# 3.0 and .NET 2.0

Something I didn’t realize until just now: in Visual Studio 2008 you can target .NET 2.0 and still get C# 3.0 features:
 
– Anonymous types
– Automatic properties
– Lambda-expressions
– Object initializers
– Type inference with "var" keyword
 
I’ve known that .NET 3.5 targets the same CLR, but it’s still nice to learn that even though it says "Microsoft (R) Visual C# 2008 Compiler version 3.5.21022.8
for Microsoft (R) .NET Framework version 3.5" the target framework version can still be 2.0.
 
What you don’t get is extension methods and LINQ implementations (to object, to sql, to xml).
As it turns out extension methods support can be easily added and LINQ can have a custom implementation which would be the case with NHibernate anyways.
 
I’m sure there’s lot of useful stuff defined exclusively in .NET 3.5, like Func<> and such, still… sweet.
Advertisements
C# 3.0 and .NET 2.0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s