Simplification
Composite Recipes
Recipes that include further recipes, often including the individual recipes below.
Recipes
- Combine 'Enumerable.Where' method chain
- Convert 'if' to assignment
- Convert anonymous method to lambda
- Convert interpolated string to concatenation
- Expression is always true or false
- Inline lazy initialization
- Inline local variable
- Join string expressions
- Merge consecutive Where calls
- Merge else with nested if
- Merge identical branches
- Merge if with parent if
- Merge switch sections with equivalent content
- Operator is unnecessary
- Remove redundant boolean literal
- Remove unnecessary braces
- Simplify Nullable<T> to T?
- Simplify Nullable<T>.HasValue
- Simplify argument null check
- Simplify boolean comparison
- Simplify coalesce expression
- Simplify code branching
- Simplify conditional expression
- Simplify do-while(true) to while(true)
- Simplify lazy initialization
- Simplify logical negation
- Simplify negated is null pattern
- Simplify nested using statement
- Simplify numeric comparison
- Simplify redundant logical expression
- Unconstrained type parameter checked for null
- Use 'is' operator instead of 'as' operator
- Use 'is' pattern instead of SequenceEqual
- Use 'not' pattern instead of negation
- Use DateTime.UnixEpoch
- Use DateTimeOffset.UnixEpoch
- Use Guid.Empty
- Use TimeSpan.Zero
- Use ^ operator for boolean inequality
- Use anonymous function or method group
- Use coalesce expression
- Use coalesce expression instead of 'if'
- Use compound assignment
- Use conditional access
- Use conditional access instead of conditional expression
- Use conditional expression in declaration
- Use conditional return expression
- Use conditional throw expression
- Use default literal
- Use exception filter
- Use expression-bodied lambda
- Use for statement instead of while
- Use pattern matching for equality comparison
- Use pattern matching for inequality comparison
- Use pattern matching for null check
- Use pattern matching instead of HasValue
- Use pattern matching instead of as
- Use pattern matching instead of is
- Use postfix increment/decrement
- Use range operator
- Use short-circuit operator
- Use string interpolation instead of concatenation
- Use string interpolation instead of string.Format
- Use string.EndsWith
- Use string.Equals instead of == for string comparison
- Use string.StartsWith instead of IndexOf comparison
- Use switch expression
- Use throw expression