Javatpoint Logo
Javatpoint Logo

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




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA