【发布时间】:2014-01-24 01:14:30
【问题描述】:
以下代码导致不同的结果:
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) 却没有?
【问题讨论】:
-
T Dump<T>(T v)来自LINQPad,它返回值并输出。
标签: c# .net types assemblies