rspec/rules/S1871/vbnet/compliant.adoc
2023-10-24 12:02:02 +00:00

30 lines
590 B
Plaintext

If the same logic is needed for both instances, then:
* in an `If` structure they should be combined
[source,vbnet,diff-id=1,diff-type=compliant]
----
If (a >= 0 AndAlso a < 10) OrElse (a >= 20 AndAlso a < 50) Then
DoFirst()
DoTheThing()
ElseIf a >= 10 AndAlso a < 20 Then
DoTheOtherThing()
Else
DoTheRest();
End If
----
* for a `Select`, the values should be put in the `Case` expression list.
[source,vbnet,diff-id=2,diff-type=compliant]
----
Select i
Case 1, 3
DoFirst()
DoSomething()
Case 2
DoSomethingDifferent()
Case Else:
DoTheRest()
End Select
----