Tuesday 21 February 2012

What are Generics in .NET?

A little while ago, a friend of mine on Facebook asked me to explain to him what generics in .NET were. As I thought this might interest more than one friend, which it did, I decided to put it in a "note" on Facebook. That was before I started this blog, so now I decided to post it here, hopefully so that more people would find it useful.

Generics in the .NET Framework is a programming technique that allows you to create a "generic" (meaning that it's not tied to a specific type) class, structure or method. The type, which is in this case "an argument", is specified when that element is used. What's interesting, and this is another advantage of Generics in .NET, is that you can restrict that type by specifying, for example, that it has to implement a certain interface or have a parameterless constructor.

This concept allows for more type safety (the type is known when the generic element is being used), while promoting reuse (you create an element that's not tied to a specific type).

Sunday 19 February 2012

Is Silverlight Dead?

"To Silverlight or Not to Silverlight!" That my dear reader is a question I've grown accustomed to hear! Here's part of a little chat I had with a friend on Messenger a couple of days ago:
"Friend" says:
yes that's exactly what i meant !
btw , is Silverlight dying?
"Me" says:
nah, it's having a headache that’s all
(from all the people who are saying it's dying )
"Friend" says:
haha, i see