我手動將一個Android Studio項目移植到Visual Studio/Xamarin。我有這樣的Java代碼:C#/ Xamarin相當於class.getSimpleName()
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.");
但這些都不編譯。
你能告訴我等值是什麼嗎?
謝謝,編譯。 –