Hi,
Is there any way to make this method inheritable and have it behave
appropriately on inherited classes? Using generics? Extension methods?
Something else?
class baseClass
{
public static string ClassName()
{
return typeof(baseClas s).FullName;
}
}
what I want is for:
class someClass : baseClass
{
....
}
and to be able to call someClass.Class Name() and have it return
"someClass"
obviously I can manually reimplement ClassName() in every inherited
subclass, but it strikes me that there should be -some- way of adding
a static method to a class that returns its own type name, without
having to do it manually for every inherited subclass.
-regards,
Dave
Is there any way to make this method inheritable and have it behave
appropriately on inherited classes? Using generics? Extension methods?
Something else?
class baseClass
{
public static string ClassName()
{
return typeof(baseClas s).FullName;
}
}
what I want is for:
class someClass : baseClass
{
....
}
and to be able to call someClass.Class Name() and have it return
"someClass"
obviously I can manually reimplement ClassName() in every inherited
subclass, but it strikes me that there should be -some- way of adding
a static method to a class that returns its own type name, without
having to do it manually for every inherited subclass.
-regards,
Dave
Comment