ASP.NET 4 Hosting :: What’s New in the .NET Framework 4
Other new features and improvements in the .NET Framework 4 are described in the following sections:
1. Attention Compatibility and Deployment
The .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, values compliance, correctness, reliability, and performance.
The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. To run grown-up applications with .NET Framework 4, you must compile your attention with the target .NET Framework version specified in the properties for your project in Visual Studio.
The following sections clarify deployment improvements.
- Client Profile
The .NET Framework 4 Client Profile supports more platforms than in before versions and provides a quick deployment encounter for your Windows Presentation Foundation (WPF), console, or Windows Forms applications.
– In-Process Side-by-Side-Execution
This feature enables an attention to load and start multiple versions of the .NET Framework in the same process. For example, you can run applications that load add-ins (or components) that are based on the .NET Framework 2.0 SP1 and add-ins that are based on the .NET Framework 4 in the same process.
2. Core New Features and Improvements
The following sections clarify new features and improvements provided by the common language runtime and the base class libraries.
- Diagnostics and Performance
Earlier versions of the .NET Framework provided no way to determine whether a particular attention domain was distressing other attention 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, you can get processor usage and reminiscence usage estimates per attention domain.
You can monitor CPU and reminiscence usage of individual attention domains. Attention domain resource monitoring is available through the managed and native hosting APIs and event tracing for Windows (ETW). When this feature has been enabled, it collects statistics on all attention domains in the process for the life of the process.
- Garbage Collection
The .NET Framework 4 provides background garbage collection. This feature replaces concurrent garbage collection in before versions and provides better performance.
- Code Contracts
Code contracts let you specify contractual information that is not represented by a method’s or type’s signature alone. The new System.Diagnostics.Contracts namespace contains classes that grant a language-neutral way to express coding assumptions in the form of preconditions, postconditions, and object invariants. The contracts improve testing with run-time checking, enable static contract verification, and help documentation generation.
- Design-Time-Only Interop Assemblies
You no longer have to ship primary interop assemblies (PIAs) to install applications that interoperate with COM stuff. In the .NET Framework 4, compilers can embed type information from interop assemblies, selecting only the types that an attention (for example, an add-in) really uses. Type safety is ensured by the common language runtime.
- Dynamic Language Runtime
The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. The DLR makes it simpler to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. To help the DLR, the new System.Dynamic namespace is added to the .NET Framework.
The expression trees are extended with new types that represent control flow, for example, System.Linq.Expressions..::.LoopExpression and System.Linq.Expressions..::.TryExpression. These new types are used by the dynamic language runtime (DLR) and not used by LINQ.
In addition, numerous new classes that help the .NET Framework infrastructure are added to the System.Runtime.CompilerServices namespace.
- Covariance and Contravariance
Numerous generic interfaces and delegates now help covariance and contravariance.
- BigInteger and Complex Numbers
The new System.Numerics..::.BigInteger structure is an arbitrary-precision integer data type that supports all the standard integer operations, including bit manipulation. It can be used from any .NET Framework language. In addition, some of the new .NET Framework languages (such as F# and IronPython) have built-in help for this structure.
The new System.Numerics..::.Complex structure represents a complex number that supports arithmetic and trigonometric operations with complex numbers.
- Tuples
The .NET Framework 4 provides the System..::.Tuple class for making tuple stuff that contain structured data. It also provides generic tuple classes to help tuples that have from one to eight components (that is, singletons through octuples). To help tuple stuff that have nine or more components, here is a generic tuple class with seven type parameters and an eighth parameter of any tuple type.
- File System Enumeration Improvements
New file enumeration methods improve the performance of applications that access large file directories or that iterate through the lines in large files.
- Reminiscence-Mapped Files
You can use reminiscence-mapped files to edit very large files and to make shared reminiscence for interprocess communication.
- 64-Bit Operating Systems and Processes
You can identify 64-bit operating systems and processes with the Environment..::.Is64BitOperatingSystem and Environment..::.Is64BitProcess properties.
- Other New Features
The following list describes additional new capabilities, improvements, and services. Numerous of these are based on customer suggestions.
1. To upport culture-sensitive formatting, the System..::.TimeSpan structure includes new overloads of the ToString, Parse, and TryParse methods, as well as new ParseExact and TryParseExact methods.
2. The new String..::.IsNullOrWhiteSpace method indicates whether a string is null, empty, or consists only of colorless-space characters. New overloads have been added to the String.Concat and String.Join methods that concatenate members of System.Collections.Generic..::.IEnumerable<(Of <(T>)>) collections.
3. The String..::.Contract method lets you concatenate each element in an enumerable collection without first converting the elements to strings.
4. Two new convenience methods are available: StringBuilder..::.Clear and Stopwatch..::.Restart.
5. The new Enum..::.HasFlag method determines whether one or more bit fields or flags are set in an enumeration value. The Enum..::.TryParse method returns a Boolean value that indicates whether a string or integer value could be successfully parsed.
6. The System..::.Environment..::.SpecialFolder enumeration contains numerous new folders.
7. You can now basically copy one stream into another with the CopyTo method in classes that inherit from the System.IO..::.Stream class.
8. New Path..::.Combine method overloads enable you to combine file paths.
9. The new System..::.IObservable<(Of <(T>)>) and System..::.IObserver<(Of <(T>)>) interfaces grant a generalized mechanism for push-based notifications.
10. The System..::.IntPtr and System..::.UIntPtr classes now include help for the addition and subtraction operators.
11. You can now enable bone idle initialization for any custom type by wrapping the type inside a System..::.Bone idle<(Of <(T>)>) class.
12. The new System.Collections.Generic..::.SortedSet<(Of <(T>)>) class provides a self-balancing tree that maintains data in sorted order after insertions, deletions, and searches. This class implements the new System.Collections.Generic..::.ISet<(Of <(T>)>) interface.
13. The compression algorithms for the System.IO.Compression..::.DeflateStream and System.IO.Compression..::.GZipStream classes have improved so that data that is by now compressed is no longer inflated. Also, the 4-gigabyte size restriction for compressing streams has been removed.
14. The new Monitor..::.Enter(Object, Boolean%) method overload takes a Boolean reference and atomically sets it to right only if the monitor is successfully entered.
15. You can use the Thread..::.Yield method to have the calling thread yield execution to another thread that is ready to run on the current processor.
16. The System..::.Guid structure now contains the TryParse and TryParseExact methods.
17. The new Microsoft.Win32..::.RegistryOptions enumeration lets you specify a volatile registry key that does not persist after the computer restarts.
Managed Extensibility Framework
The Managed Extensibility Framework (MEF) is a new library in the .NET Framework 4 that helps you build extensible and composable applications. MEF enables you to specify points everywhere an attention can be extended, to expose services to offer to other extensible applications and to make parts for consumption by extensible