Is there any way to get the assembly that contains a class with name TestClass?
I just know the class name, so I can’t create an instance of that. And
Type objectType = assembly.GetType("TestClass");
didn’t work for me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the
Type objectTypein the question, I assume you are actually after the type by name (not the assembly); so assuming the assembly is loaded and the type name is unique, LINQ may help:However, it may be better to work with the assembly-qualified name instead of the type name.