Currently, the docs for what Type.FullName returns says:
The fully qualified name of the type, including its namespace but not its assembly;
or null if the current instance represents a generic type parameter, an array
type, pointer type, or byref type based on a type parameter, or a generic type
that is not a generic type definition but contains unresolved type parameters.
However, I've found that some of the conditions in which this property is documented to return null are false. SharpLab shows the property will happily state that the full name for int[] is "System.Int32[]", and according to @CyrusNajmabadi it also does not seem to return a null for pointer types. This means that the doc comment seems to be in need of an update to be more accurate.
As an aside, this stems from the following question I had: Can I be reasonably guaranteed the property won't ever return null in the following situation?
public class Foo<T>
where T : MyBase
{
private static string _tName = typeof(T).FullName;
}
public abstract partial class MyBase { }
I think the issue is primarily how the sentence is being parsed, and in particular that this "an array
type, pointer type, or byref type based on a type parameter" is one phrase (with "based on a type parameter" applying to all three of array type, pointer type, and byref type).
```C#
using System;
class Program
{
static void Main()
{
Type t = Type.GetType("A`1");
// a generic type parameter
Console.WriteLine(t.GetMethod("TypeParam").ReturnType.FullName is null); // true
// an array type, pointer type, or byref type based on a type parameter
Console.WriteLine(t.GetMethod("ArrayTypeParam").ReturnType.FullName is null); // true
Console.WriteLine(t.GetMethod("PointerTypeParam").ReturnType.FullName is null); // true
Console.WriteLine(t.GetMethod("ByRefTypeParam").ReturnType.FullName is null); // true
}
}
class A
{
public static T TypeParam() => throw new Exception();
public static T[] ArrayTypeParam() => throw new Exception();
public static unsafe T* PointerTypeParam() => throw new Exception();
public static ref T ByRefTypeParam() => throw new Exception();
}
```
Most helpful comment
I think the issue is primarily how the sentence is being parsed, and in particular that this "an array
type, pointer type, or byref type based on a type parameter" is one phrase (with "based on a type parameter" applying to all three of array type, pointer type, and byref type).
```C#
using System;
class Program
{
static void Main()
{
Type t = Type.GetType("A`1");
}
class A where T : unmanaged
{
public static T TypeParam() => throw new Exception();
public static T[] ArrayTypeParam() => throw new Exception();
public static unsafe T* PointerTypeParam() => throw new Exception();
public static ref T ByRefTypeParam() => throw new Exception();
}
```