expression-bodied member
A method or property whose body is a single expression written after =>, such as public bool InStock => Units > 0;.
In more detail
It is shorthand for a body with one return statement. A property written this way is computed each time it is read and stores nothing.
Related terms
- property — A named value belonging to an object; in languages such as C# and Python, it can also be a member that looks like a field but runs code when read or written.
- lambda expression — A short anonymous function written inline and passed to other code, such as a condition for a filter.
Taught in
- Classes, Interfaces, and Object-Oriented C# — Modern .NET Core, C# & Enterprise Microservices