Difference between Property and Method

Posted by Asim Sajjad on Stack Overflow See other posts from Stack Overflow or by Asim Sajjad
Published on 2010-03-30T11:26:48Z Indexed on 2010/03/30 12:03 UTC
Read the original article Hit count: 451

Filed under:
|
|

Which one is better to use when it come to return value for example

public int EmployeeAge
{
    get{return intEmployeeAge};
}

And

public int EmployeeAge()
{
    return intEmployeeAge;
}

Which one is better and why? And what is best programming practice to use when we have secnario like above ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about properties