相关疑难解决方法(0)

.NET:在静态方法中确定"this"类的类型

在我可以使用的非静态方法中this.GetType(),它将返回Type.如何Type在静态方法中获得相同的内容?当然,我不能只写,typeof(ThisTypeName)因为ThisTypeName只在运行时才知道.谢谢!

.net c# static-methods types

92
推荐指数
4
解决办法
6万
查看次数

c#从静态函数中打印类名

是否可以在静态函数中打印类名?

例如......

public class foo
{

    static void printName()
    {
        // Print the class name e.g. foo
    }

}
Run Code Online (Sandbox Code Playgroud)

c# static

29
推荐指数
5
解决办法
2万
查看次数

标签 统计

c# ×2

.net ×1

static ×1

static-methods ×1

types ×1