V
Vagif Abilov
Hello,
I've come to a problem that I am not able to solve, although something is
telling me there must be a solution.
Let's say I have a class MyType:
public class MyType
{
public MyType() {}
public static void DoSomethingWithTypeName()
{
doSomething("MyType");
}
}
The problem is that I don't want to pass a literal string to doSomething
method - this should not be necessary since this method is executed from
within MyType context, so I should be able to retrieve the type name.
However, since static method does not have access to "this" (for obvious
reason), I can't use .NET Type non-static methods to retrieve class name.
And I can't find any static function that would do that.
I am puzzled because CLR must have such run-time information, but how to get
access to it?
Help is appreciated
Vagif Abilov
vagif @ online.no
Oslo Norway
I've come to a problem that I am not able to solve, although something is
telling me there must be a solution.
Let's say I have a class MyType:
public class MyType
{
public MyType() {}
public static void DoSomethingWithTypeName()
{
doSomething("MyType");
}
}
The problem is that I don't want to pass a literal string to doSomething
method - this should not be necessary since this method is executed from
within MyType context, so I should be able to retrieve the type name.
However, since static method does not have access to "this" (for obvious
reason), I can't use .NET Type non-static methods to retrieve class name.
And I can't find any static function that would do that.
I am puzzled because CLR must have such run-time information, but how to get
access to it?
Help is appreciated
Vagif Abilov
vagif @ online.no
Oslo Norway