Features of .NET Framework 4.0
This contains new features and improvements in the .NET Framework version 4.0.
Common Language Runtime (CLR)
It contains new features in security, parallel computing, performance and diagnostics, dynamic language runtime.
The .NET Framework 4.0 provides simplifications, improvements, and expanded capabilities in the security model.
The .NET Framework 4.0 introduces a new model for writing multithreaded and asynchronous code that greatly simplifies the work of application and library developers. This model enables developers to fine-grained and scalable parallel code in a natural language without having to work directly with threads or the thread pool. Two new classes introduced Parallel and Task. Parallel LINQ (PLINQ), which is a parallel implementation of LINQ to Objects, enables similar functionality through declarative syntax.
Performance and Diagnostics
In addition .NET Framework 4.0 provides improvements in startup time, working set sizes, and faster performance for multithreaded applications.
Now Event Tracing for Windows (ETW) events can be accessed for diagnostic purposes to improve performance.
Performance Monitor (Perfmon.exe) now enables you to disambiguate multiple applications that use the same name and multiple versions of the common language runtime loaded by a single process by doing registry modification.
Code contracts let you specify contractual information that is not represented by a method's or type's signature alone. The new System.Diagonostics.Contracts namespace contains classes that provide a language-neutral way to express coding assumptions in the form of pre-conditions, post-conditions, and object invariants. The contracts improve testing with run-time checking; enable static contract verification, and documentation generation.
- Perform static bug finding, which enables some bugs to be found without executing the code.
- Create guidance for automated testing tools to enhance test coverage.
- Create a standard notation for code behavior, which provides more information for documentation.
With lazy initialization, the memory for an object is not allocated until it is needed. Lazy initialization can improve performance by spreading object allocations evenly across the lifetime of a program.
Dynamic Language Runtime(DLR)
The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. To support the DLR,a new namespace is added "System.Dynamic".
In-Process Side-by-Side Execution
In-process side-by-side hosting enables an application to load and activate multiple versions of the common language runtime (CLR) in the same process.
New interoperability features and improvements include the following:
- PIAs are not a problem now days. Compilers embed the parts of the interop assemblies that the add-ins actually uses, and type safety is ensured by the common language runtime.
In the .NET Framework 4.0, you can attach profilers to a running process at any point, perform the requested profiling tasks, and then detach
The .NET Framework 4.0 provides background garbage collection.
Covariance and Contravariance
Several generic interfaces and delegates now support covariance and contravariance. Covariant and contravariant generic type parameters provide greater flexibility in assigning and using generic types
A tuple is a simple generic data structure that holds an ordered set of items of heterogeneous types. Tuples are supported natively in languages such as F# and IronPython, .NET Framework 4.0 adds eight new generic tuple classes, and also a Tuple class that contains static factory methods for creating tuples.
The .NET Framework 4.0 class library contains the new System.Runtime.ExceptionServices for advanced exception handling.
The key new features in I/O are efficient file enumerations, memory-mapped files, and improvements in isolated storage and compression.
Isolated Storage Improvements
Partial-trust applications, such as WPF browser now have same capabilities in .NET Framework as in Silverlight. The default quota size is doubled, and applications can prompt the user to approve or reject a request to increase the quota.
The .NET Framework 4.0 provides the capability to monitor the performance of your application domains.
Application Domain Resource Monitoring
Earlier there was no way to determine whether a particular application domain is affecting other application domains, because the operating system APIs and tools, such as the Windows Task Manager, were precise only to the process level. Starting with the .NET Framework 4.0, we can get processor usage and memory usage estimates per application domain.
Application domain resource monitoring is available through the managed AppDomain class, native hosting APIs, and event tracing for Windows (ETW). When this feature has been enabled,
64-bit View and Other Registry Improvements
Windows registry improvements include the following:
- Ability to specify a 32-bit or 64-bit view of the registry with the
Threading includes the following:
The following sections describe new threading features.
Thread-Safe Collection Classes
To provide thread safe and lock free access to resources when needed a new namespace is aaded named as System.Collections.Concurrent, basically meant for multi threading purpose.
Enhancements have been made in System.Net, HttpWebRequest, HttpListner, SmtpClient namespaces for handling authentication in windows and available for Windows 7.