38 lines
798 B
Plaintext
38 lines
798 B
Plaintext
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
|
|
|
|
[source,vbnet]
|
|
----
|
|
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
|
|
|
|
[source,vbnet]
|
|
----
|
|
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[]
|