Closed kgrontis closed 1 year ago
We should change the exception throwing to the new built in methods provided by Microsoft. https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception.throwifnullorempty?view=net-7.0 https://learn.microsoft.com/en-us/dotnet/api/system.argumentnullexception.throwifnull?view=net-7.0#system-argumentnullexception-throwifnull(system-object-system-string)
The ArgumentException.ThrowIfNullOrEmpty was introduced in .NET 7 & ArgumentNullException.ThrowIfNull on .NET 6.
ArgumentException.ThrowIfNullOrEmpty
ArgumentNullException.ThrowIfNull
Example: from
protected AbstractCollectionDecorator(ICollection<T> collection) { _collection = collection ?? throw new ArgumentNullException(nameof(collection)); }
to
protected AbstractCollectionDecorator(ICollection<T> collection) { ArgumentNullException.ThrowIfNull(collection); _collection = collection; }
We should change the exception throwing to the new built in methods provided by Microsoft. https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception.throwifnullorempty?view=net-7.0 https://learn.microsoft.com/en-us/dotnet/api/system.argumentnullexception.throwifnull?view=net-7.0#system-argumentnullexception-throwifnull(system-object-system-string)
The
ArgumentException.ThrowIfNullOrEmpty
was introduced in .NET 7 &ArgumentNullException.ThrowIfNull
on .NET 6.Example: from
to