Robert MacLean
19 May 2010
Note: This post is part of a series and you can find the rest of the parts in the series index.
There is a bunch of tiny additions in .NET 4 which I have not covered yet, this post provides a quick hit list of some of the new and improved features:
New
- StringBuilder.Clear: Quick method to clear a string builder.
- StopWatch.Reset: Quick method to reset a stop watch timer.
- IntPtr & UIntPtr: Both have had two new methods added, one for addition and one for subtraction.
- Thread.Yield: Allows you to yield execution to another thread that is ready to run on the current processor.
- System.Guid: Has got two new methods, TryParse and TryParseExact to allow for testing of the parsing.
- Microsoft.Win32.RegistryView: This allows you to request 64bit or 32bit views of the registry.
- Environment: Now contains two properties to identify 64bit scenarios:
- Is64BitOperatingSystem: To identify if the OS is 64bit.
- Is64BitProcess: To identify if the process is 64bit.
- System.Net.Mail.SmtpClient: Support for SSL
Improved
- Path.Combine: A new method overload to allow you to combine file paths.
- Compression.DeflateStream & Compression.GZipSteam: They have been improved so that they so no try to compress already compressed data.
- Compression.DeflateStream & Compression.GZipSteam: The 4Gb size limit has been removed.
- Monitor.Enter: A new overload has been added which allows you to pass in a reference boolean which returns true of the monitor was successfully entered.
- Microsoft.Win32.RegistryOptions: Now includes an option to specify a volatile key which is removed when the system restarts.
- Registry keys are no longer limited to 255 characters.
- System.Net.Mail.MaiMessage: Support for new headers
- HeadersEncoding: Sets the type of text encoding used in the mail header.
- ReplyToList: Sets the list of addresses to use when replying to a mail. This replaces ReplyTo which only supported one email address.
- System.Net.NetworkCredential: To improve security passwords can now be stored in a SecureString.
- ASP.NET Hashing: The default value has been changed from SHA1 to SHA256.
- ASP.NET Output caching: Previously setting the output cache to ServerAndClient also required calling SetOmitVaryStar to ensure it would be cached on the client. From .NET 4, calling of SetOmitVaryStar is no longer needed.
- TimeZoneInfo.Local & DateTime.Now: Both of these follow the OS daylight savings settings rather than using the .NET Framework settings.
- When running on Windows 7, locale info will be retrieved from the OS rather than being stored in the framework.
- Support for all 1400 characters of Unicode 5.1.
- ServiceInstaller.DelayedAutoStart: If you on a more modern OS (Vista, Win 7 etc…) then you can services can start as Automatic Delayed. This means they start, but after system boot so that the user gets in quickly. This is now possible for your .NET apps using the DelayedAutoStart property.