创建和实例类型返回null

0 c#

frm =(Form)Assembly.GetEntryAssembly().CreateInstance("EditFrom");
return frm;
Run Code Online (Sandbox Code Playgroud)

这将返回null值.如何获得价值

Dar*_*rov 5

尝试指定类的完全限定名称,包括它所在的命名空间:

var frm = (Form)Assembly
    .GetEntryAssembly()
    .CreateInstance("SomeNamespace.EditForm");
Run Code Online (Sandbox Code Playgroud)

其中SomeNamespace是其中的命名空间EditForm类被定义.还要确保已正确指定类名.