GetInterfaces()返回泛型接口类型,与全名= NULL全名、接口类型、GetInterfaces、NULL

2023-09-06 08:22:38 作者:£日已★夕暮彡

任何人都可以向我解释为什么GetInterfaces()在下面的code返回具有一个接口类型全名= NULL?

Can anyone explain to me why GetInterfaces() in the below code returns an interface type that has FullName = null?

public class Program
{
    static void Main(string[] args)
    {
        Type[] interfaces = typeof (Data<>).GetInterfaces();
        foreach (Type @interface in interfaces)
        {
            Console.WriteLine("Name='{0}' FullName='{1}'", @interface.Name, @interface.FullName ?? "null");
        }
    }
}

public class Data<T> : IData<T>
{
    public T Content { get; set; }
}

public interface IData<T>
{
    T Content { get; set; }
}

的程序的输出是:

The output of the program is:

Name=IData`1' FullName='null'

我有种期待:

I kind of expected:

Name=IData`1'
FullName='ConsoleApplication2.IData`1'

请赐教:)

推荐答案

http://blogs.msdn.com/b/haibo_luo/archive/2006/02/17/534480.aspx