Use ArgumentOutOfRangeException.ThrowIfLessThan()

Proprietary

Replace if (value < other) throw new ArgumentOutOfRangeException(nameof(value)) guard clauses with ArgumentOutOfRangeException.ThrowIfLessThan(value, other). Also handles reversed other > value and <=/ThrowIfLessThanOrEqual. Available since .NET 8.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfLessThan
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfLessThan

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.