When does `Assembly.GetType(name)` return `null`?

后端 未结 6 1699
太阳男子
太阳男子 2021-01-12 17:47

I have a code like shown below

public static Type ToType(Type sType)
{    
    Assembly assembly = Assembly.Load(SerializableType.AssemblyName);
    type = a         


        
6条回答
  •  星月不相逢
    2021-01-12 18:05

    I guess you forgot to mention namespaces. The correct way would be

    assembly.GetType(MyNameSpace+sType.Name)
    

提交回复
热议问题