include::../why-dotnet.adoc[]

== How to fix it

=== Code examples

==== Noncompliant code example

[source,vbnet,diff-id=1,diff-type=noncompliant]
----
Dim foo = {"a", "b", "c" }
Property Foo() As String() ' Noncompliant
    Get
        Dim copy = foo.Clone      ' Expensive call
        Return copy
    End Get
End Property
----

==== Compliant solution

[source,vbnet,diff-id=1,diff-type=compliant]
----
Dim foo = {"a", "b", "c" }
Function GetFoo() As String()
    Dim copy = foo.Clone
    Return copy
End Function
----

== Resources

=== Documentation

* https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/properties[Properties (Visual Basic)]
* https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/objects-and-classes/#fields-and-properties[Fields and properties]
* https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/concepts/collections[Collections (Visual Basic)]

include::../rspecator.adoc[]