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 about Internet Explorer and Microsoft Edge
Read in English
Read in English Edit
Twitter LinkedIn Facebook Email

Expression-bodied-members

  • Article
  • 09/15/2021
  • 2 minutes to read

In this article

Overview

The style rules in this section concern the use of expression-bodied members when the logic consists of a single expression.

  • Use expression body for constructors (IDE0021)
  • Use expression body for methods (IDE0022)
  • Use expression body for operators (IDE0023 and IDE0024)
  • Use expression body for properties (IDE0025)
  • Use expression body for indexers (IDE0026)
  • Use expression body for accessors (IDE0027)
  • Use expression body for lambda expressions (IDE0053)
  • Use expression body for local functions (IDE0061)

See also

  • Code style rules reference
  • Code style language rules

Feedback

Submit and view feedback for

This product This page
View all page feedback

Additional resources

  • Previous Versions
  • Blog
  • Contribute
  • Privacy
  • Terms of Use
  • Trademarks
  • © Microsoft 2023

Additional resources

In this article

  • Previous Versions
  • Blog
  • Contribute
  • Privacy
  • Terms of Use
  • Trademarks
  • © Microsoft 2023