GetType and TypeOf confusion

Both VB and C# have an operator called TypeOf (or typeof in C#) but they perform two completely different things. In VB there are also two kind of GetType() calls, the object.GetType() method which is part of the .Net framework and the VB language specific GetType() operator. Are you confused yet? Don’t worry, in this article I will try to explain the difference between these operators and the object.GetType() method. The TypeOf, typeof, GetType operators The VB TypeOf operator is used together with the Is keyword and is used for checking if an object is of a particular type. result … Continue reading GetType and TypeOf confusion

Boxing and Unboxing in .Net

In this article I will try to explain the concepts of Boxing and Unboxing. There are two types of objects within the .Net framework, value types and reference types. Value types are stored on the stack while reference types are always stored on the heap. Converting a value type into a reference type is called Boxing while converting it back from a reference type to a value type is called Unboxing. Value Types Value types are primitive types like System.Int32 (Integer in VB, int in C#) or System.Double. These types are mapped directly to the Framework Class Library (FCL) and … Continue reading Boxing and Unboxing in .Net

Top 10 signs that you are a geek

Here’s a compilation of my personal view of top 10 signs that you are a geek, in descending order. 9. You see a guy drink a pint of beer in less than 8 seconds and you are impressed by his download speed. 8. You don’t say that people are standing in a long line outside a popular night club but that they are caught in a slow serial queue. Not that you would ever find yourself in that situation since you don’t have a social life. 7. You wear a T-shirt that reads <body> on the front and </body> on the back … Continue reading Top 10 signs that you are a geek

Nifty extension methods

One of my favorite features in .Net 3.5 is the ability to extend a class using extension methods. Earlier you could only extend a class either by creating a new class that inherits from the first class or you could create a partial class. Of course if you have the source code of the original class you could just write the new code directly in it and recompile it. In many cases you don’t have access to the source code of a class and if the class is also sealed (NotInheritable in VB) you would not be able to extend … Continue reading Nifty extension methods