c # reflection type take to obtain a null

Often get with a Type GetType

1. Type in the assembly of want to get inside the currently executing, you can get directly

Type myType1 = Type.GetType("System.Int32");

2. Type not want to get the current assembly inside, get direct access to null

Type t = Type.GetType("System.Runtime.InteropServices.RuntimeInformation");
// t == null

You must be used to acquire AssemblyQualifiedName

Type t = Type.GetType("System.Runtime.InteropServices.RuntimeInformation, System.Runtime.InteropServices.RuntimeInformation, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");

 

Guess you like

Origin www.cnblogs.com/chenyingzuo/p/12366016.html