top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Define Property in C# ?

+3 votes
Define Property in C# ?
posted Nov 28, 2014 by Manikandan J

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
Best answer

Properties are a type of class member , that are exposed to outside world as a pair of Methods.For example for the static field Minsalary, we will Create a property.

private double minimumSalary;
public static double MinSalary
return minSalary;
minSalary = value;

So when we execute the following lines code

double minSal = Employee. MinSalary;

get Method will get triggered and value in minimumSalary field will be returned.When we execute ,

Employee. MinSalary = 3000;

set Method will get triggered and value will be stored in minimumSalary field .

answer Dec 1, 2014 by Shivaranjini
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.