Which new C#/VB features require .net Framework 4?
I remember reading in passing that some of the new language features in C# and VB that are available in VS2010 are backwards compatible with earlier versi开发者_Python百科ons of the framework, but that others are not. I'm pretty sure this was in reference to the new property syntax in VB.
Which new features are language features vs which ones are framework specific?
I would suggest reading What's New in .NET 4.0 for a comprehensive answer, rather than for bits and bobs people can remember and come up with on here.
There is a definitive list on that page.
Co- and contra-variance doesn't require .NET framework 4, but the relevant interfaces and delegate types have been updated to support variance. E.g. IEnumerable<T>
is now IEnumerable<out T>
.
The new dynamic
keyword is tied to the IDynamicMetaObjectProvider
interface which is used to implement dynamic binding. You could say that dynamic binding requires the DLR which is part of the new runtime and framework.
The dynamic
type is new for C# 4, it works with the new Dynamic Language Runtime extension to the CLR.
精彩评论