dotnet / dotnet/dotnet-api-docs
Incorrect doc on 'Type.FullName'
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
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](https://sharplab.io/#v2:C4LgTgrgdgPgAgJgIwFgBQiDM6De6AEh+iCBReaRVxSAnABQBiA9swDwCWUwAfAHQAVAHIBDALYBTAJQBuMtRoMW7OEgAM/YeOlzKCxU1aduAbQC6m0ZNnzqqpUYCCYMCICel7Tb2EAvun80dDhMYgR8ZTYBHlxbLmAJMCgRABsaADYaNXwtSXwcfABzCWAZfF98AF58YDcABwlmADN6ASk+RggUlKsJXV8gA===) 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?
```cs
public class Foo
where T : MyBase
{
private static string _tName = typeof(T).FullName;
}
public abstract partial class MyBase { }
```
Contributor guide
Assessment
This issue has not been assessed yet.