Use ArgumentOutOfRangeException.ThrowIfGreaterThan()
ProprietaryReplace if (value > other) throw new ArgumentOutOfRangeException(nameof(value)) guard clauses with ArgumentOutOfRangeException.ThrowIfGreaterThan(value, other). Also handles reversed other < value and >=/ThrowIfGreaterThanOrEqual. Available since .NET 8.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net8. UseThrowIfGreaterThanmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net8. UseThrowIfGreaterThanInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.