Introduction In this article am trying to point out some of the most important additions to the new .Net framework 4.0 beta. Common Language Runtime(CLR) Security Simplifications, improvements, and expanded capabilities in the security model Parallel Computing New programming model for writing multi-threaded and asynchronous code. Parallel and Task classes and other related types supports this new model. Parallel Linq (PLINQ) is a parallel implementation of LINQ to objects. Performance Improvement in startup time, working set sizes, and faster performance in multi-threaded applications. ETW Events Event Tracing for Windows (ETW) events can be used for diagnostic purposes to improve performance. Perfmon.exe now enables to disambiguate multiple application that use the same name and multiple versions of the CLR loaded by a single process. Code Contracts Lets us to specify contractual information that is not represented by a method's or type's signature. New System.Diagnostics.Contract 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 document generation 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. You can enable lazy initialization for any custom type by wrapping the type inside a Lazy(T) class Dynamic Language Runtime DLR is a new runtime enviroment that adds a seto if services for dynamic languages to the CLR. The DLR makes it easier to develop dynamic languages to run on the .net framework and to add dynamic features to statically typed languages. System.Dynamic namespace is added to the .Net framework. Serveral other addition includes System.Runtime.CompilerServices. In-Process Side-by-Side Execution Enables an application to load and activate multiple versions of the CLR in the same process. The benefit is we can run application based on .net 2.0 and .net 4.0 in the same process. Interoperability -Compiler will embed the parts of the interop assemblies that the add-ins actually use, and type safety is ensured by the CLR -System.Runtime.InteropService::ICustomeQueryInterface to create a customized, managed code implementation of the IUnknown::QueryInterface method. Applications can use the customized implementation to return a specific interface for a particular interface ID. Profiling We can attach profilers to a running process at any point, perform the requested profiling task, and then detach. IClrProfilingInterface::AttachProfiler Method. GarbageCollection Background garbage collection. Convariance and Contravariance Generic interfaces and delgates now support covariance and contravariance. BCL Collections and DataStructure Enhancement in BigInteger structure, SortedSet generic class and tuples Exception Handling New System.Runtime.ExceptionServices namespace Corrupted State Exceptions-CLR no longer delivers corrupted state exceptions that occur in the operating system to be handled by managed code, unless we apply the HandleProcessCorruptedStateExceptionsAttribute to the method that handles the corrupted state exception. I/O Efficient file enumerations, memory-mapped files, and improvements in isolated storage and compression. Reflection Provides the capability to monitor the performance of your application domains. We can get processor usage and memory usage estimates per application domain. 64-bit view and other registry improvements Ability to specify a 32-bit or 64-bit view of the registry with RegistryView class. RegistryOptions enumertions lets us specify a volatile registry key that does not persist after the computer restarts. Threading New Montior.Enter method overload takes a boolean reference and automatically sets it to true only if the monitor successfully entered. Thread.Yield method to have the calling thread yield execution to another thead that is ready to run on the current processor. New CancellationTokenSource class is used to create a CancellationToken that may be passed to any number of operations on multiple threads, hence cancelling Asynchronous operations. New System.Collections.Concurrent namespace introduces several new thread-safe collection classes that provide lock-free access to items whenever useful. New Barrier class enables multiple threads to work on an algorithm cooperatively by providing a point at which each task can signal its arrival and then block until the other participants in the barrier have arrived. Other additions include CountDownEvent, ManaualResetEventSlim, SemaphoreSlim, SpinLock, SpinWait. Networking Integrated windows authentication is handled by HttpWebRequest, HttpListener,SmtpClient, SslStream, NegotiateStream. Web Enhancements includes in WebForms, Dynamic Data and Visual Web Developer What’s New in ASP.NET and Web Development. And much more. For more information please visit msdn Conclusion The artcle explains what all things got changed in .Net framework 4.0 as well as the new feature additions to .Net framework 4.0. I hope this was a helpful post. For more information and queries you can directly reach me at amalhashim@gmail.com Thank you Amal |