GetInterfaces()返回泛型接口类型,与全名= NULL [英] GetInterfaces() returns generic interface type with FullName = null

查看:214
本文介绍了GetInterfaces()返回泛型接口类型,与全名= NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以向我解释为什么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'

请赐教:)

推荐答案

<一个href="http://blogs.msdn.com/b/haibo_luo/archive/2006/02/17/534480.aspx">http://blogs.msdn.com/b/haibo_luo/archive/2006/02/17/534480.aspx

这篇关于GetInterfaces()返回泛型接口类型,与全名= NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆