Home » C# Expression Bodied Getters and Setters

C# Expression Bodied Getters and Setters

by Online Tutorials Library

C# Expression bodied getters and setters

C# expression body is a single line expression statement. It is used to provide single life definition to the method, constructor or property. We can use it to provide definition for the getter and setter.

In the following example, we are providing expression body for the getter and setters.

C# Expression bodied getters and setters Example

Output:

Peter 

Next TopicC# Async Main

You may also like