What are Properties

Properties are used to access or modify the private members (private variables).

We can say it’s a mediator between private variables and initialization.

Below we have two private members one is private string name and private string address.


  1. I am creating an object for talents class which is “t” and constructor will initialize id name and course name into public int id=420 and public string coursename =java.

    Here “this” operator is used to differentiate with ordinary variables and class variables.

  2. I cannot initialize directly into private variables so I go for properties concept. If you declare {get; set;} directly its initialize the values. Above I have initialize the address with its.

  3. Above I have initialize the name with murali.

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now