Use ArgumentOutOfRangeException.ThrowIfZero()
ProprietaryReplace if (value == 0) throw new ArgumentOutOfRangeException(nameof(value)) guard clauses with ArgumentOutOfRangeException.ThrowIfZero(value). Also handles reversed 0 == value. Available since .NET 8.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net8. UseThrowIfZeromod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net8. UseThrowIfZeroInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.