You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code triggers SA1131 (Use readable conditions) :
// Totally contrived example code :-) Only here to illustrate the current behaviour.classTestClass{privatereadonlySystem.ActionmyAction;publicTestClass(boolstuff){myAction=stuff?DoSomething:DoSomethingElse;}publicboolMyCondition=>myAction==DoSomething;// SA1131 here!privatevoidDoSomething(){}privatevoidDoSomethingElse(){}}
The code fix changes the condition like this: public bool MyCondition => DoSomething == myAction;
DoSomething is in effect a constant in that condition, so I think that SA1131 should not be triggered.
Unusual case, but might be worth considering if the change is easy?
Tested with 1.2.0-beta.507.
The text was updated successfully, but these errors were encountered:
The following code triggers SA1131 (Use readable conditions) :
The code fix changes the condition like this:
public bool MyCondition => DoSomething == myAction;
DoSomething is in effect a constant in that condition, so I think that SA1131 should not be triggered.
Unusual case, but might be worth considering if the change is easy?
Tested with 1.2.0-beta.507.
The text was updated successfully, but these errors were encountered: