diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-10-06 20:21:23 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-10-06 20:21:23 +0200 |
| commit | a9a5fcde81060c9da2096235d61128006339a2ee (patch) | |
| tree | 3c3f7da26dffcc1a6589bcfc1cec2a5634e92c0e /Emby.Server.Implementations/Sorting/IndexNumberComparer.cs | |
| parent | 927fe33d3a0ec7f9e0fb568cfd423c6e8b966c9d (diff) | |
Use ArgumentNullException.ThrowIfNull helper method
Did a simple search/replace on the whole repo (except the RSSDP project)
This reduces LOC and should improve performance (methods containing a throw statement don't get inlined)
```
if \((\w+) == null\)
\s+\{
\s+throw new ArgumentNullException\((.*)\);
\s+\}
```
```
ArgumentNullException.ThrowIfNull($1);
```
Diffstat (limited to 'Emby.Server.Implementations/Sorting/IndexNumberComparer.cs')
| -rw-r--r-- | Emby.Server.Implementations/Sorting/IndexNumberComparer.cs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/Sorting/IndexNumberComparer.cs b/Emby.Server.Implementations/Sorting/IndexNumberComparer.cs index c5b00afb1..1bcaccd8a 100644 --- a/Emby.Server.Implementations/Sorting/IndexNumberComparer.cs +++ b/Emby.Server.Implementations/Sorting/IndexNumberComparer.cs @@ -24,15 +24,9 @@ namespace Emby.Server.Implementations.Sorting /// <returns>System.Int32.</returns> public int Compare(BaseItem? x, BaseItem? y) { - if (x == null) - { - throw new ArgumentNullException(nameof(x)); - } + ArgumentNullException.ThrowIfNull(x); - if (y == null) - { - throw new ArgumentNullException(nameof(y)); - } + ArgumentNullException.ThrowIfNull(y); if (!x.IndexNumber.HasValue && !y.IndexNumber.HasValue) { |
