rspec/rules/S2353/vbnet/rule.adoc

44 lines
908 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
In most cases, indexed properties should be named Item for consistency. Exceptions are when there exists a name which is obviously better, for example ``++System.String.Chars(System.Int32)++``.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,vbnet]
2021-04-28 16:49:39 +02:00
----
Module Module1
Dim array = {"apple", "banana", "orange", "strawberry"}
ReadOnly Property Foo(ByVal index As Integer) ' Noncompliant
Get
Return array(index)
End Get
End Property
End Module
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,vbnet]
2021-04-28 16:49:39 +02:00
----
Module Module1
Dim array = {"apple", "banana", "orange", "strawberry"}
ReadOnly Property Item(ByVal index As Integer)
Get
Return array(index)
End Get
End Property
End Module
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
endif::env-github,rspecator-view[]