.NET 4, do you know the new features? - Top 10 Least Known Features
More in this series can be found in the introduction.
[
]
We start off with the features that people just didn’t know about. I measured this on a percentage, i.e., the percentage of people who answered that they did not know about feature X.
The top 10 features in the dark are:
CLR/BCL: Microsoft.Win32.RegistryView
Percentage of People That Didn’t Know (PPDK): 90%
Introduction: On the 64-bit version of Windows, portions of the registry are stored separately for 32-bit and 64-bit applications. There is a 32-bit view for 32-bit applications and a 64-bit view for 64-bit applications.
Thoughts: If you just write to or read from the registry in your application, you do not need to specify this. This means this feature is really only needed by people opening registry values for Windows or other applications—a very specific usage—so I’m not surprised by this finding.
More detail: http://msdn.microsoft.com/en-us/library/microsoft.win32.registryview.aspx
| CLR/BCL: Addition & Subtraction with IntPtr & UIntPtr |
|---|
PPDK: 85%
Introduction: Adds an offset to the value of a pointer.
Thoughts: I can’t think of a scenario for the usage of this that most business application developers would care about—maybe it is useful for interop or game development. So, not surprising it’s very unknown.
More detail: http://msdn.microsoft.com/en-us/library/system.intptr.op_addition.aspx
| CLR/BCL: System.Device.Location |
|---|
PPDK: 84%
Introduction: Allows you to talk to GPS sensors that Windows 7 supports.
Thoughts: Most Windows 7 machines—laptops, desktops, etc.—do not have a built-in GPS yet, so it’s not surprising this isn’t well known. It’s a pity since it’s an awesome feature to include in applications and can work with a software GPS like GeoSense for Windows.
More detail: https://www.sadev.co.za/content/net-4-baby-steps-part-x-location-location-location
| CLR/BCL: 64-bit identification on the Environment class |
|---|
PPDK: 83%
Introduction: There are two new Boolean properties on System.Environment, one indicating if the OS is 64-bit and one indicating if the process is 64-bit.
Thoughts: Not sure why this isn’t better known—maybe people just don’t care about 64-bit vs. 32-bit, or maybe they’re not optimizing for the operating system.
More detail: https://www.sadev.co.za/content/net-4-baby-steps-part-xiii-tiny-steps
| CLR/BCL: Improved NGen subsystem |
|---|
PPDK: 82%
Introduction: NGen is the subsystem (or command line) that compiles your assemblies from IL to machine code, which can result in startup performance improvements.
Thoughts: This is a very specialized system, and I’ve never seen anyone except Microsoft use it. So, not surprised at all that people don’t know about it.
More detail: http://blogs.msdn.com/b/clrcodegeneration/archive/2009/05/03/improvements-to-ngen-in-.net-framework-4.aspx
| CLR/BCL: New options in Environment.SpecialFolder |
|---|
PPDK: 80%
Introduction: This is used to help find the path to those special folders (think My Documents, which changes from profile to profile, for example) and is used in conjunction with GetFolderPath (see below).
Thoughts: There are 25 new options, and some are just useless (Windows and Fonts, for example: if you know the System drive, they are always <system drive>:\Windows and <system drive>:\Windows\Fonts, respectively, since Windows has to be installed to a folder called Windows). But many others are very good and useful, especially the x86-specific folders if you’re on a x64 OS and support for new Windows 7 features, like common folders.
So why it’s so unknown is beyond me—this is good stuff!
More detail: https://www.sadev.co.za/content/net-4-baby-steps-part-xi-special-folders
| CLR/BCL: ETW Support |
|---|
PPDK: 80%
Introduction: ETW (Event Tracing for Windows) is a feature of Windows for doing logging at the kernel level. It’s brilliant, as you can log thousands of messages per second with very low CPU usage. With .NET 4, we have support for this in our applications and support to log information from the framework, like garbage collections.
Thoughts: Even though this is brilliant and powerful, logging is a solved problem. So this is really only used or needed by people with some massive performance issues, and I don’t believe most developers are working on solutions at that scale.
More detail: http://naveensrinivasan.com/2010/03/17/using-clr-4-0-event-tracing-for-windows-etw-along-with-application-etw/
| CLR/BCL: GetFolderPath improvements |
|---|
PPDK: 80%
Introduction: GetFolderPath is used with Environment.SpecialFolder (above), and the improvements allow for creating the folder and controlling verification if the folder is created.
Thoughts: The GetFolderPath additions are a new overload, so if you were using it prior to .NET 4, it may look exactly the same. This could just be a discoverability issue.
More detail: https://www.sadev.co.za/content/net-4-baby-steps-part-xi-special-folders
| CLR/BCL: MemoryCache |
|---|
PPDK: 79%
Introduction: MemoryCache is a per-process in-memory cache for your application, which is very easy to use regardless of application type. There is also some low-level plumbing that makes it possible to have the cache stored in other locations, like files or SQL.
Thoughts: WHAT THE HELL, PEOPLE?! Don’t you people use caching?! I don’t get this at all—not even slightly. If you have an idea why this is so unknown, please share in the comments.
More detail: https://www.sadev.co.za/content/net-baby-steps-part-vii-caching
| CLR/BCL: GUID Parsing Improvements |
|---|
[
] PPDK: 77%
Introduction: This is a way to parse a string into a GUID, regardless of the format of the GUID.
Thoughts: I just don’t think people need to do parsing of GUIDs that much, so it isn’t needed that often.
More detail: http://msdn.microsoft.com/en-us/library/system.guid.parse.aspx