.NET 4 - The new stuff!

I jumped onto the .NET bandwagon quite late, and as a consequence have missed out on all the improvements that have been made between versions. It's now on version 4, but I'd never be able to tell you the differences between 3.5 and 4, for example! So (more as a lesson for me than you), I thought I'd do quick run down of a few of the brand spanking new language features that were introduced into the latest version of the framework.

And they are... :

    Parallel Computing seems to be becoming all the rage as computers become more powerful and people try to make best use of it. The fact that the first multi-core processor was introduced in 2001, and now PCs with four and even six cores are commonly available, shows us the way that these things seem to be going. Simply put, more cores = better*! With this in mind, the onus falls on software developers to make use of these hardware improvements and Microsoft have tried to make it easy to do so by introducing a new model for writing multi-threaded, parallel code. It brings new classes, such as Parallel and Task, to help with this, as well as PLINQ (parallel language integrated query) which is an addition to the existing LINQ extensions.
    Lazy Initialization is a simple way of delaying the initialisation of an object until use of it is actually required. There are already design patterns to do things like this such as using a method to retrieve an object, as below:

    public class FruitBowl
    {
     private Apple _apple;
     private Orange _orange;
     private Banana _banana;
     public Applet GetTheApple()
     {
      if (_apple == null)
      {
       _apple = new Apple();
      }
      
      return _apple;
     }
    }

Tags: