Base types, Collections, Diagnostics, IO, RegEx…
The Visual Studio 2010 and .NET Framework 4.0 CTP is available for download as of last week. The CTP contains new functionality throughout the .NET Framework, including several new BCL features and improvements:
We’re also evaluating a number of potential new features and improvements for .NET 4.0 beta:
There are also a bunch of improvements to the CLR in .NET 4.0. Here’s a high-level summary:
You can learn more about the next version of the CLR in Joshua Goodman’s PDC session on Microsoft .NET Framework: CLR Futures.
Over the next couple of weeks we’ll be posting more about the new functionality that’s available in the CTP. Do note that we’re working on many other improvements for 4.0 that we’re not quite ready to announce just yet.
As always, we’d love to hear what you think of the CTP and announcements so far.
Hi Andrew,
>>>>> So why is it that String.Replace(String,String) still doesn't take a StringComparison arg? The String.Contains method is another oversight.
This indeed has been a longstanding oversight that we’ve been meaning to address for quite some time. Unfortunately the nature of our 3.0 and 3.5 releases (layer cake model) means we haven’t been able to address some of these oversights since we released 2.0. The good news is that we’re planning to finally address this in 4.0 :-)
>>>>> However, I think we all know the dangers of people recompiling their .NET 1/2/3 code against .NET 4.0 and suddenly getting the different behaviour. Much migration guidance needs to be given.
We are very mindful of this. In addition to guidance, we’ll also provide an app compat switch that will allow older apps to specify that they want the old behavior.
Thanks,
Justin
Hi Stu,
>>>>> I've been reading with interest about the SSE support in Mono... any chance similar changes could appear in MS's CLR?
Unfortunately not for 4.0. But this is something we’ll be evaluating for future releases.
Hi Anders,
>>>>> Regarding the string class, I'd like to request that string.Contains is overloaded to take params (i.e. "contains all these strings" instead of just one operator). Also string.ContainsAny with params would be nice as it's a very common pattern among developers to check a string for either N or any inclusive instances of other strings.
Thanks for the suggestions. We’ll see if we can fit some of these in for 4.0.
Hi Steven,
It's a CLI limitation that co/contravariance is supported only on interfaces and delegates. This form of variance is already supported in the CLR and can be used in IL with the +/- notation.
Regarding the C# change -- they've added keywords to allow use of variance, but C# (and any .NET language) is limited by the CLI/CLR support. That is, unless they want to add extra support on top, which I understand Eiffel .NET does.
At the moment, there are no plans for broader variance support, but if you haven't already, you may want to check out Eric Lippert's blog series on co/contravariance. In the comments sections, you'll see a lot of requests and discussion around broader variance support...and an extended discussion of the issues involved.
Kim
> Regarding the string class, I'd like to request that string.Contains is overloaded to take params (i.e. "contains all these strings" instead of just one operator).
string s;
...
new[] { "foo", "bar", "baz" }.All(sub => s.Contains(sub))
> Also string.ContainsAny with params would be nice as it's a very common pattern among developers to check a string for either N or any inclusive instances of other strings.
new[] { "foo", "bar", "baz" }.Any(sub => s.Contains(sub))
Obviously I've been looking at the proposed C# 4.0 features pretty carefully, and I promise I'll
Great news about the tuples. I'm looking forward towards quite a lot of F#/C# mixed code now :)
Regarding contracts: are you going to use them throughout the BCL itself (and other parts of the FCL) as well? I recall seeing some seemingly contract-related attributes on the (internal) BigInteger class in 3.5 - more to come? Obviously, contracts, and particularly the static type checking feature - are only truly useful when they are used from top to bottom.
Also, since people above remind of some common refactoring requests, let me add one as well: generify more BCL classes! I mean stuff like WeakReference<T>, Type<T>, and so on.
int19h,
We will be adding contracts throughout as much of the BCL as we can in .NET 4.0, but we won't have 100% coverage. We're also getting the rest of the FCL on board. This will be a phased approach over the next couple of releases, where each release will have better coverage throughout .NET and more streamlined tools.
We don't have plans to add WeakReference<T> or Type<T> in 4.0, but these (and some other generic types) are things we are considering for the future. Thanks for the suggestions.
Justin,
Great feedback and great news.
Thanks!
Andrew
Design by Contract with .NET 4.0
Hi, this sounds all very exciting!
> In Process Side-by-Side: support for multiple CLR versions running in the same process.
Does this mean that it may be possible to (safely) write shell extensions in .NET starting with 4.0?
I’ve just found an interesting post with some of the new stuff we’ll have on the next version of the
.NET What's New in the BCL in .NET 4.0 NetMon API – Capture, Parse and and Capture File Access
.NETWhat'sNewintheBCLin.NET4.0NetMonAPI–Capture,ParseandandCaptureFileAccess(wi...