Qualified type names and GetType(String)

  • Thread starter Thread starter KK
  • Start date Start date
K

KK

Two quick questions:

1.) Given only a string containing fully qualified type name (e.g.
"System.Drawing.Rectangle"), is there a consistent way to get the Type
object that the string corresponds to that will work with most types?

2.) If no to question 1, then given the string containing the fully
qualified type name, is there a way to get the fully qualified assembly
containing that type?

Thanks again for your help. =)
 
1.) Given only a string containing fully qualified type name (e.g.
"System.Drawing.Rectangle"), is there a consistent way to get the Type
object that the string corresponds to that will work with most types?

2.) If no to question 1, then given the string containing the fully
qualified type name, is there a way to get the fully qualified assembly
containing that type?


In general the answer is no to both questions, since multiple
assemblies can contain types with the same type name in the same
namespace. You either need an assembly-qualified type name or somehow
restrict the set of assemblies to look in.



Mattias
 
Back
Top