2014-01-06 79 views
2

下面的代码导致不同的结果:Type.GetType()和Assembly.GetType()返回不同的结果

class X<R> 
{ 
    public class Y { } 
} 

...

var t = typeof(X<int>.Y); 
var n = t.ToString().Dump(); // <- X`1+Y[System.Int32] 

Type.GetType(n).Dump(); // <-- X`1+Y[System.Int32] 
t.Assembly.GetType(n).Dump(); // <-- null 

为什么Type.GetType(n)找到的类型,但不t.Assembly.GetType(n)

+0

'T Dump (T v)'来自LINQPad,它返回值并输出它。 –

回答