A personal repository of technical notes. - CSC

.NET 2.0 Type.GetType (String) Returns NULL

Problem
Type.GetType (String, true) throws the following error:
Could not load type 'MyType' from assembly 'MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Solution
String needs to be the assembly-qualified name of the Type:
MyType.GetType().AssemblyQualifiedName


References
Haibo Luo's weblog : Type.GetType(string typeName) returns null !?
http://blogs.msdn.com/haibo_luo/archive/2005/08/21/454213.aspx

Type.GetType Method (String) (System)
http://msdn.microsoft.com/en-us/library/w3f99sx1(VS.80).aspx

No comments:

Post a Comment