C# .NET 3.0/3.5 features in 2.0 using Visual Studio 2008

.net, c#, visual-studio

Solution

You can use any new C# 3.0 feature that is handled by the compiler by emitting 2.0-compatible IL and doesn't reference any of the new 3.5 assemblies:

- Lambdas (used as `Func<..>`, not `Expression<Func<..>>` )

- Extension methods (by declaring an empty `System.Runtime.CompilerServices.ExtensionAttribute`)

- Automatic properties

- Object Initializers

- Collection Initializers

- LINQ to Objects (by implementing `IEnumerable<T>` extension methods, see LinqBridge)

Problem

What are some of the new features that can be used in .NET 2.0 that are specific to C# 3.0/3.5 after upgrading to Visual Studio 2008? Also, what are some of the features that aren't available? Available - Lambdas - Extension methods (by declaring an empty System.Runtime.CompilerServices.ExtensionAttribute) - Automatic properties - Object initializers - Collection Initializers - LINQ to Objects (by implementing IEnumerable extension methods, see LinqBridge) Not Available - Expression trees - WPF/Silverlight Libraries

Original source

Related problems