Getting System.Type from static method

Is it possible to get the System.Type of a subclass from a static method in an abstract class?


public abstract class MyBase
{
public static void MyMethod()
{
//Get System.Type here?
}
}

public class MyDerived: MyBase
{
}

When I call


MyDerived.MyMethod();

Is it then possible to get the type of MyDerived in the method MyMethod()?

Thanks
Brian

[445 byte] By [codefund.com] at [2008-2-8]
# 1

I'm having the same problem and I haven't yet been able to find a solution.

Can anyone help me?

Papuashu at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 2

No, this is not possible. Although the C# compiler allows you to call MyMethod via the MyDerived class, underneath, the method is actually being called via MyBase.

The only way you can do this, is to make MyMethod a instance method.

DavidM.Kean-MSFT at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...

.NET Development

Site Classified