.NET中运行时Java类的等价物是System.Type对象。有两种方法可以获得一个:在任何对象实例上调用GetType()
(来自System.Object,所有事情都支持它)或使用the typeof
operator。
你也许也只能使用原始类名,但我希望它希望它的Type对象。这将取决于IKVM如何实现Java反射;我真的不知道。
当然,你也可以使用.NET反射来完成整个事情。我不知道知道,因为你使用了一些奇怪的非标准的Java反射类似的东西,但它看起来像只是试图获得“默认”实例一类...?
// I haven't tested this, but it may work:
ProjectController pc = Lookup.getDefault().lookup(typeof(ProjectController));
// You could also just try it without the ".class" part (since "class" is reserved in C#):
ProjectController pc = Lookup.getDefault().lookup(ProjectController);
// Or, if you want the .NET reflection "proper" way to do what I *think* you're attempting:
ProjectController pc = typeof(ProjectController).GetContructor(Type.EmptyTypes).Invoke(null);
// Of course, that's just the same thing as this simple line, so I probably misunderstood:
ProjectController pc = new ProjectController();