Within a static class you cannot use the keyword “this” so I can’t call this.GetType().GetFullName if I have
public static class My.Library.Class
{
public static string GetName()
{
}
}
Is there anything I can call from within GetName that will return My.Library.Class
you can get the type of a predetermined class with:
If you need “the class that declares this method”, you’ll need to use
However, there’s a chance this method will be inlined by the compiler. You can shift this call to the static constructor / initialiser of the class (which will never be inlined – log4net recommends this approach):
Applying
[MethodImpl(MethodImplOptions.NoInlining)]might help, but you should really read up on that if you considering itHTH – Rob