dotnet / dotnet/dotnet-api-docs

Add example to ArgumentNullException.ThrowIfNull

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

Description

[ArgumentNullException.ThrowIfNull()](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception.throwifnull?view=net-6.0) should contain an example. It looks like this is currently the only public method that uses the `CallerArgumentExpressionAttribute` so the usage might not be clear to everyone yet.

This would be especially helpful until the documentation actually shows the `CallerArgumentExpressionAttribute` (see https://github.com/dotnet/dotnet-api-docs/issues/7080#issuecomment-1004343388).

The example could even hint at the "global static using" feature like shown here: https://github.com/dotnet/csharplang/issues/2145#issuecomment-910081172

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.