We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It may happen that programmers write code as following:
public string SomeProperty { get; set; } public void DoSomething(int value) { if (value == 1) { SomeProperty = "something"; return; } if (value == 2) { SomeProperty = "something else"; return; } if (value == 3) { SomeProperty = "something different"; return; } SomeProperty = string.Empty; }
They evaluate a value and - dependent on the result - assign a value to some property.
It would be much better if they would separate the evaluation and the assignment into different methods, as in following code:
public string SomeProperty { get; set; } public void DoSomething(int value) { SomeProperty = Evaluate(value); } private string Evaluate(int value) { if (value == 1) { return "something"; } if (value == 2) { return "something else"; } if (value == 3) { return "something different"; } return string.Empty; }
That would lead to less side effects.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It may happen that programmers write code as following:
They evaluate a value and - dependent on the result - assign a value to some property.
It would be much better if they would separate the evaluation and the assignment into different methods, as in following code:
That would lead to less side effects.
The text was updated successfully, but these errors were encountered: