i have question about why should we use return in get,if dont use what happend?.plz see the code below:
private int _NumberOfDoors= 4;
public int NumberOfDoors
{
get
{
return _NumberOfDoors;
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
getis just a method that returns a value, so you have to return a value. If you don’t your code won’t compile! You could of course have thegetautomatically implemented for you:This is a read-only property.