Brian Keller posed a question to the readers of his blog asking what we thought, if there were such a thing, the “that” keyword should do in C#. What a fantastic idea! My suggestion – the that keyword would be used to allow access to inherited classes from the base class. IE:
public class MyBase
{
public MyBase()
{
//only call CallToMethod() in a specific class
if( typeof(that).ToString().Equals("MyChild") )
that.CallToMethod();
}
}
public class MyChild : MyBase
{
public void CallToMethod()
{
// more code goes here...
}
}
Yeah I know it’s really dangerous and would definitely have some overhead associated with it but the functionality would be awesome!

Brian Keller · June 18, 2007 at 12:44 pm
LOL – I’m surprised my post is still getting replies! Great idea, thanks for the code snippet to back it up! :-)