Hi,
Now when I have started working on dot net 3.5 the feature I love most is the extension method. I know many of you will be surprised that it’s not LINQ or the other new feature that are there in visual studio but this one. Well let me tell you how it let me code the way I want to (without leaving me to the limitation of the C sharp).
The kind of coder I am I use the Response.write() a lot. Whenever debugging some problem, for each response I have to add this line. But with extension methods I can add a new extension method to the object class to get this done pretty easily (and make my code look better).
Here is a simple extension method I created to help me out.
public static void Response(this object obj)
{
Response.write (obj);
}
Now I do not have to write Response.Write. Instead I can write
int I = 9;
//Response.Write(I); //No need for this now
I.Response();
Or
String str = “vikramlakhotia.com”;
//Response.Write(str); //No need for this now
str.Response();
That is s much more cool and good looking. I ma really starting to like these feature in Dot Net framework 3.5. Way to go dot net team.
Vikram