C# Expression-bodied membersC# expression bodied members allows us to define members (property or method) definition in a single expression. This expression is very concise and readable in nature. We can use expression body definition with the following.
C# Expression-bodied members syntaxC# Expression-bodied methodIt consists of a single expression. If method has a return type, expression must return similar type. Let's see an example. C# Expression-Bodied Method ExampleOutput Peter John C# Expression bodied Property GetWe can use expression body to implement get property. A single expression can be used to set a value for the property. We should not use return statement in this property. Let's see an example, that implements expression body in get property. C# Expression-Bodied Get Property ExampleOutput Javatpoint Next TopicC# Null Propagator |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India