With Microsoft Visual Studio 2010 (news, site) out in beta, it seems like a good time to have a look at what's new and improved in the .NET framework.

There have been so many changes to the .NET framework 4.0 beta 1 that it would be impossible to cover everything. From improved security to parallel computing to a new runtime environment (dynamic language runtime) to workflow to lots of new features for the Web, one can get lost in the details.

Here are some of the highlights.

Common Language Runtime (CLR)

Security Changes

There are two big changes to Security in the .NET framework 4.0:

  • Machine Wide Security is Gone: By default, machine level security is turned off with the intent of no longer providing it in the CLR. CAS -- code access security -- policy should be replaced by something offered through the operating system such as Windows Software Restriction Policies (SRP) which works for both managed and unmanaged code.
  • Security Transparency: This is now the default enforcement mechanism, separating application code from infrastructure code (critical code), effectively grouping code by privilege. Level 1 was introduced in version 2 of the framework. Level 2 has been introduced with version 4. Transparent code can only work within the permissions it has, meaning it cannot execute, derive from or contain critical code.

Parallel Computing

Parallel computing is a new programming model for developing multithreaded and asynchronous code. Included in the .NET framework are a new runtime, new class library types and diagnostic tools.

ParallelComputing.jpg

Parallel Computing Architecture

Dynamic Language Runtime

The Dynamic Language Runtime (DLR) is a new runtime environment for dynamic languages to run in the CLR. With a dynamic language you don't have to set the type of an object at design time. 

Javascript, PHP, Ruby and Python are examples of dynamic languages. Frequently used for writing websites and data transformations, the DLR adds a set of objects to both C# and Visual Basic to support dynamic behavior and enable these languages to interoperate with dynamic languages.

IronRuby and IronPython were both developed using the DLR. There is an open source version of the DLR available on CodePlex.

DLR.jpg

DLR

Want to see this in action? Check out Phil Haack's blog entry: Fun With Method Missing and C# 4.

Learning Opportunities


A couple of other nice features in the .NET framework 4.0 CLR include:

  • In Process Side by Side Execution: Run multiple versions of the .NET framework in a single process. This is beneficial when you have components that run on older versions of the framework mixed with components built on the newer versions.
  • Lazy Initialization: Improve performance by wrapping your custom type inside class called System.Lazy. This ensures the memory for an object is not allocated before it is required.

Web

With the new .NET framework comes a new version of ASP.NET, which means changes that should be good for most developers.

  • Core Services: Instead of output caching using memory, configure a custom output cache provider; auto start your application if you live on IIS 7.5 and Windows 2008 R2; a new PermanentRedirect method; a new compression option for out-of-process session/state providers.
  • AJAX: Enhancements include client template rendering, live data binding, declaratively instantiating behaviors and controls, a new class for client side interaction with ADO.NET services and more.
  • Visual Designer: Now compliant with CSS 2.1, IntelliSense Snippets for HTML and JScript.
  • Web Forms: Set meta tags, better browser capability support, support for ASP.NET routing, more control over view state for individual controls and more.
  • Web Application Deployment: New Web Packages (in zip format), easily transform your web.config file between environments, one-click publishing through remote IIS administration or through Visual Studio itself.
  • MVC Support: Support for web applications built using ASP.NET MVC.

Workflow

Some good improvements to Workflow Foundation (WF). Workflows are now supposed to be easier to create and maintain. Improvements include:

  • A new Model: Workflow is now based on activities and not specific types of workflow classes.
  • Flowchart: This is a new model that follows more traditional flow-control structures.
  • Activity Library: A built-in and expanded library of activities including data access, looping and SharePoint interaction.
  • Workflow Designer: You can extend the WF Designer using Windows Presentation Foundation.
  • Integration with WCF: New messaging activities and message correlation are among the improvements.

FlowchartWorkflow.jpg

Flowchart Workflow
 

Pick up a training kit to help you get started with workflows in the .NET framework 4.

And That's Not All

There are also a number of improvements to the Base Class Libraries for things like collections and data structures, exception handling, threading and reflection.

Scott Gu has a post series demonstrating how to use some of the new features of Visual Studio and the .NET framework 4. Good to check out.

For more information on what the .NET framework 4.0 beta 1 has to offer, there are a number of videos on Channel9. You can download beta 1 of the framework now, along with beta 1 of Visual Studio 2010.