Skip to content

Incorrect doc on 'Type.FullName' #4637

Open
@Joe4evr

Description

@Joe4evr

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 { }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions