is there a way to do this with automatic properties ?
private IList<string> List;
public IList<String> list
{
get { return List.ToList().AsReadOnly(); }
set { List = value; }
}
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.
No there is not. Automatic properties do little more than wrap simple return and assignment statements around a backing field. The only customization allowed is accessibility. If you want to do anything other than the most basic property, you’ll need to use a full property.