FlaxEngine / FlaxEngine/FlaxEngine

[Suggestion] Replace 'throw new ArgumentNullException' with 'ArgumentNullException.ThrowIfNull' where applicable

Open
#2,936 0 comments 0 reactions 0 assignees View on GitHub
scripting suggestion
Dominant language
C++
Stars
7k
Forks
713
Avg merge
7d 11h
Merged PRs (30d)
19

Description

This is a very minor thing but it is slightly less error-prone and is a little more compact.
```cs
//Before
if (foo == null)
throw new ArgumentNullException(nameof (foo));

//After
ArgumentNullException.ThrowIfNull(foo);
```
Here's an example of where this change would apply
https://github.com/FlaxEngine/FlaxEngine/blob/dcadb11a2045416675c2c85c0fc3d7720d28a123/Source/Engine/Utilities/Extensions.cs#L148

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.