Windows 8 consumer preview and Visual Studio 11 Ultimate Beta with .NET Framework 4.5 Beta are released

Today Microsoft is releasing some of the new and awaited content as beta.

Windows 8 consumer preview:

Microsoft is taking huge risks with the Windows 8 operating system they are building. It is completely different from what we are used in the past of the Windows operating system. It’s Windows reimagined and reinvented from a solid core of Windows 7 speed and reliability. It’s an all-new touch interface. It’s a new Windows for new devices. And it’s your chance to be one of the first to try it out.

You can find the Windows 8 consumer preview here:

It sure looks like a serious adaptation compared to what we are used now.

Visual Studio 11 Beta and .NET Framework 4.5 Beta:

Of course with the release of the new Windows 8 consumer preview, the new Visual Studio Beta and .NET Framework 4.5 Beta are being released as they are the components needed to develop applications on the Windows 8 Runtime:

I’m definately looking forward to install the Windows 8 consumer preview on a virtual machine and have a look at the next windows we will be working with!


Using LINQ to SQL to retrieve, modify and delete data with DataContext and use mapped stored procedures

One of the predecessors of Entity Framework is LINQ to SQL. It is not deprecated, but Microsoft will no longer add features to LINQ to SQL. The ORM flagship of the .NET platform is Entity Framework and I suggest you also focus on Entity Framework if you want to use a ORM mapper to solve the impedance mismatch.

Even though LINQ to SQL is no longer being improved on, it belongs to one of the skills you have to understand for the MCTS Accessing Data with Microsoft.NET Framework 4:


(Great thinking there Microsoft!)

I created a simple dummy database in my local SQL server to work on:


Continue reading

Using LINQ to XML with XDocument, XElement, XAttribute and XNamespace

One of the interesting features of LINQ is LINQ to XML, if you compare the capabilies of system.xml.linq to system.xml

When creating a new XML document with LINQ to XML you will be using the system.xml.linq namespace, instead of the default system.xml namespace. The primary classes you will use to build a new XML document will be the XDocument, XElement and XAttribute classes.

Creating a new XML document can easily be done with LINQ to XML as following:

LINQ to XML create new document

As usual, when creating XML we start by creating the document which has 1 root node, which in our case is the XElement with name “Customers”. Within the rootnode Customers there will be childnodes “Customer”, which will also hold childnodes which contain information about the customer. LINQ to XML allows you to create an entire XML document by just adding elements within the constructor of the XDocument and XElement classes:

LINQ to XML XElement constructor

Continue reading

Implementing and executing C# extension methods

One of the useful features added to c# 3.0 is the introduction of Extension methods. It allows you to attach methods to sealed classes or classes that you do not have access to.

Let’s say you are working with a lot of numbers in your application and often have to check whether the numbers you are working with are even or uneven. What we are used to do is creating a helper class to extend a certain class like this:

C# Extension Methods

And we call this method by Extensions.IsEven method to do the validation whether the value is even or not:

C# Extension methods

One of the features C# 3 adds is that you can add these extension methods directly to the class you are working with. We are working with an integer, and it would be great if we could invoke the IsEven() method directly from the integer and not doing it through a Helper class. One of the advantages is that someone else in your project also doesn’t have to go dig through all the helper classes to see what methods exist in there to know what possible methods there are.

Changing the method to an extension method is a small change:

C# Extension methods

Continue reading