Confirmed features of .NET 4.0? [closed]

2019-04-15 01:57发布

问题:

Does anyone know what will be in .NET 4.0?

I found tuples on codeplex:

....
// NOTE : this is a TEMPORARY and a very minimalistic implementation of Tuple'2, 
// as defined in http://devdiv/sites/docs/NetFX4/CLR/Specs/Base Class Libraries/Tuple Spec.docx
// We will remove this after we move to v4 and Tuple is actually in there
public struct Tuple<TFirst, TSecond>
....

回答1:

Parallel Extensions

WCF/WF improvements

I expect BigInteger will be back, too. I'd really like to see a bunch of the F# immutable collections become part of ".NET proper" too - and that wouldn't surprise me at all.



回答2:

I have seen the usage of dynamic keyword in C# 4.0 from Anders Hejlsberg's JAOO talk. It allows calling methods in a late-bindish way which will really help in COM interop scenarios.

Usage:

// Instead of this:
object calc = GetCalculator();
Type calcType = calc.GetType();
object res = calcType.InvokeMember("Add", 
    BindingFlags.InvokeMethod, null,
    new int[] { 10, 20 });
int sum = Convert.ToInt32(res);

// you can write this:
dynamic calc = GetCalculator();
int sum = calc.Add(10, 20);

Static and Dynamic http://img266.imageshack.us/img266/9469/dynamicxf4.png



回答3:

Glenn Block confirmed on a recent Herding Code episode that MEF would be part of .NET 4.0.



标签: .net .net-4.0