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'
Please enlighten me 🙂
https://learn.microsoft.com/archive/blogs/haibo_luo/type-fullname-returns-null-when
https://msdn.microsoft.com/en-us/library/system.type.fullname.aspx
Here is an example of a situation where
Type.FullNameisnull, boiled down from the documentation: