rspec/rules/S2353/vbnet/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

49 lines
958 B
Plaintext

== Why is this an issue?
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)++``.
=== Noncompliant code example
[source,vbnet]
----
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
----
=== Compliant solution
[source,vbnet]
----
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)
=== Message
Rename this property to "Item".
endif::env-github,rspecator-view[]