Closed. This question needs details or clarity。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?添加详细信息并通过editing this post阐明问题。
                        
                        3年前关闭。
                                                                                            
                
        
Type myType = Type.GetType(nameOfTypeString);
DoSomething(typeof(myType));

// signature of DoSomething
DoSomething(Type myType)


抱怨它无法解析myType。

最佳答案

typeof运算符返回Type类的实例。

在这种情况下,您已经有一个Type实例。您应该能够简单地将其传递给方法:

DoSomething(myType);

10-08 06:18