private Type GetTypeFromName(string typeName)
{
if (typeName == null || typeName.Length == 0)
{
return null;
}
int commaIndex = typeName.IndexOf(',');
Type t = null;
if (commaIndex == -1)
{
t = _type.GetTypeInfo().Assembly.GetType(typeName);
}
if (t == null)
{
t = Type.GetType(typeName);
}
if (t == null && commaIndex != -1)
{
// At design time, it's possible for us to reuse
// an assembly but add new types. The app domain
// will cache the assembly based on identity, however,
// so it could be looking in the previous version
// of the assembly and not finding the type. We work
// around this by looking for the non-assembly qualified
// name, which causes the domain to raise a type
// resolve event.
//
t = Type.GetType(typeName.Substring(0, commaIndex));
}
return t;
}