rspec/rules/S2352/vbnet/rule.adoc

40 lines
826 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Indexed properties are meant to represent access to a logical collection. When multiple parameters are required, this design guideline may be violated, and refactoring the property into a method is preferable.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,vbnet]
2021-04-28 16:49:39 +02:00
----
Module Module1
ReadOnly Property Sum(ByVal a As Integer, ByVal b As Integer) ' Noncompliant
Get
Return a + b
End Get
End Property
End Module
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,vbnet]
2021-04-28 16:49:39 +02:00
----
Module Module1
Function Sum(ByVal a As Integer, ByVal b As Integer) ' Compliant
Return a + b
End Function
End Module
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
endif::env-github,rspecator-view[]