Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info
Read in English
Read in English Feedback Edit
Twitter LinkedIn Facebook Email

Expression-level preferences

  • Article
  • 07/02/2022
  • 2 minutes to read

In this article

.NET expression-level preferences

The style rules in this section concern the following expression-level preferences that are common to C# and Visual Basic:

  • Add missing cases to switch statement (IDE0010)
  • Use object initializers (IDE0017)
  • Use collection initializers (IDE0028)
  • Use auto property (IDE0032)
  • Use explicitly provided tuple name (IDE0033)
  • Use inferred member name (IDE0037)
  • Use conditional expression for assignment (IDE0045)
  • Use conditional expression for return (IDE0046)
  • Convert anonymous type to tuple (IDE0050)
  • Use compound assignment (IDE0054 and IDE0074)
  • Use 'System.HashCode.Combine' (IDE0070)
  • Simplify interpolation (IDE0071)
  • Simplify conditional expression (IDE0075)
  • Convert 'typeof' to 'nameof' (IDE0082)

C# expression-level preferences

The style rules in this section concern the following expression-level preferences that are specific to C#:

  • Inline variable declaration (IDE0018)
  • Simplify 'default' expression (IDE0034)
  • Use local function instead of lambda (IDE0039)
  • Deconstruct variable declaration (IDE0042)
  • Use index operator (IDE0056)
  • Use range operator (IDE0057)
  • Add missing cases to switch expression (IDE0072)
  • Simplify 'new' expression (IDE0090)
  • Use tuple to swap values (IDE0180)

See also

  • Code style rules reference
  • Code style language rules

Feedback

Submit and view feedback for

This product This page
View all page feedback
  • Previous Versions
  • Blog
  • Contribute
  • Privacy & Cookies
  • Terms of Use
  • Trademarks
  • © Microsoft 2022

In this article

  • Previous Versions
  • Blog
  • Contribute
  • Privacy & Cookies
  • Terms of Use
  • Trademarks
  • © Microsoft 2022