← All recipes
Moderne licensed

Use OperatingSystem methods instead of RuntimeInformation

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Style.FindUseOperatingSystemMethodsArtifactOpenRewrite.Recipes.CSharp.CodeQuality

Use OperatingSystem.IsWindows() and similar methods instead of RuntimeInformation.IsOSPlatform(). The OperatingSystem methods are more concise and can be optimized by the JIT.

Single recipecsharpstylecode-qualityProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.CodeQuality.Style.FindUseOperatingSystemMethods

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality