Here if you observe:
more understanding:
public int Empage
{
get { return Age; }
set { Age = value; } where value is a hidden parameter
}C# is very intelligent with properties and returns and sets the age which you assign. Following is the code formore understanding:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestingOops
{
class Employee
{
private int Age;
private string Name;
public int Empage
{
get { return Age; }
set { Age = value; }
}
public string Empname
{
get { return Name; }
set { Name = value; }
}
}
class Program
{
static void Main(string[] args)
{
Employee emp = new Employee();
emp.Empage = 25;
int myage = emp.Empage;
emp.Empname = "Ujjwal";
string myname = emp.Empname;
Console.WriteLine("Employee Name is : \'{0}\' and Age is {1}", myname,myage);
Console.ReadKey();
}
}
}