C#/Xamarin 相当于 class.getSimpleName()
C#/Xamarin equivalent of class.getSimpleName()
我正在手动将 Android Studio 项目移植到 Visual Studio / Xamarin.我有这个 Java 代码:
throw new IllegalStateException(MyClass.class.getSimpleName() + " is not initialized.");
我正在尝试找到 .getSimpleName()
的等价物。
我在网上找到了一些可以尝试的东西:
throw new IllegalStateException(MyClass.ShortClassName +" is not initialized.);
throw new IllegalStateException(nameOf(MyClass) + " is not initialized.");
但是这些都不编译。
你能告诉我等价物是什么吗?
我正在手动将 Android Studio 项目移植到 Visual Studio / Xamarin.我有这个 Java 代码:
throw new IllegalStateException(MyClass.class.getSimpleName() + " is not initialized.");
我正在尝试找到 .getSimpleName()
的等价物。
我在网上找到了一些可以尝试的东西:
throw new IllegalStateException(MyClass.ShortClassName +" is not initialized.);
throw new IllegalStateException(nameOf(MyClass) + " is not initialized.");
但是这些都不编译。
你能告诉我等价物是什么吗?