Blogroll Me!

Lives in India/Chennai/Chennai, speaks English.
This is my blogchalk:
India, Chennai, Chennai, English.

A blog on what is happening in the .NET world in India.  

Anand's .NET WebLog


Home Archives Contact

Thursday, July 17, 2003 :::
MyClass:::  

I don't remember where I read this, but it was in one of the newsgroups. This is another of those things hidden in VB.NET, which a lot of people do not know about.

This is similar to the Me reference, but rather will return a reference only to the containing class, irrespective of the type of the holding variable. Thus even if a method is overridden, using MyClass will always call the method in the current class only.

Most useful in Base classes - Use MyClass.MyMethod, will always call the base class MyMethod even if the variable that is being used is of a derived class, and MyMethod is overriden in the derived class

MSDN has a suprising lucid explanation, with some example. Don't blame me if you can't understand the example when you read it, but run it and you will get it...




::: posted by Anand at 2:02 PM

Comments: Post a Comment

 
Subscribe to Anand's .NET WebLog!


powered by Bloglet


Listed on Blogwise Listed on BlogShares Technorati Profile

Powered by Blogger