dotnet / dotnet/dotnet-api-docs

The ReferenceEqualityComparer.Instance property is incorrectly shown as nullable

Open
#4,875 0 comments 0 reactions 0 assignees View on GitHub
area-System.Collections Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.referenceequalitycomparer.instance?view=net-5.0:

> ```cs
> public static System.Collections.Generic.ReferenceEqualityComparer? Instance { get; }
> ```

Having this property be nullable makes no sense. Docs tooling bug maybe? The .NET Core source shows that it's not nullable:

https://github.com/dotnet/runtime/blob/v5.0.0-rc.1.20451.14/src/libraries/Common/src/System/Collections/Generic/ReferenceEqualityComparer.cs#L30

```cs
///
/// Gets the singleton instance.
///
public static ReferenceEqualityComparer Instance { get; } = new ReferenceEqualityComparer();
```

https://github.com/dotnet/runtime/blob/v5.0.0-rc.1.20451.14/src/libraries/System.Collections/ref/System.Collections.cs#L418

```cs
public static System.Collections.Generic.ReferenceEqualityComparer Instance { get { throw null; } }
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.