I have a setter in a property a bit like this:
set
{
string whatever = regex.replace();
_fieldStub = whatever;
}
As you can see, there is no use of the value keyword. Is this still a perfectly valid set block?
Thanks
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.
Yes, it technically is a valid property setter. There is nothing which requires you to use the value passed in.
However, this property will likely be highly unusual, and violate all expected behavior. As such, I would recommend making this a method instead.