A Generic C# 3.0 Collection Initialization Adapter

February 29th, 2008

C# 3.0 comes with this new language feature called Collection Initializaton. It’s more or less syntactical sugar that simplifies the way you initialize collections.

Where you pre 3.0 would initialize a list of integers like this:

List<int> list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(3);

You now can do this:

List<int> list = new List<int>() {1, 2, 3};

Now, this is somewhat beautified, but it does exactly the same as in the first example. The compiler parses the code and calls the Add method, implemented by List<int>, once for every integer in the initialization list.

Now, wouldn’t this be nice to do on your own proprietary collections? Read the rest of this entry »

in·con·sis·tent IIII

February 29th, 2008

When it comes to Visual Studio installation folders, why is it that Microsoft don’t just settle for one naming convention?

Here it seems that thy’re not sure what their product is named. Sometimes is .NET, sometimes not. Sometimes by year, sometimes by version (with or without the decimal):

Microsoft Visual Studio .NET 2003
Microsoft Visual Studio 8
Microsoft Visual Studio 9.0

At times they find capitalized words totally unnecessary:

microsoft frontpage

And sometimes a space, sometimes not:

Microsoft ASP.NET
Microsoft.NET

- petter

Powered by WordPress. Entries (RSS) and Comments (RSS).