
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Method for creating empty arrays ``++Array.Empty(Of TElement)++`` was introduced in .NET 4.6 to optimize object instantiation and memory allocation. It also improves code readability by making developer's intent more explicit. This new method should be preferred over empty array declaration.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,vbnet]
|
|
----
|
|
Public Sub Method()
|
|
Dim Values1(-1) As Integer ' Noncompliant
|
|
Dim Values2 As Integer() = New Integer() {} ' Noncompliant
|
|
Dim Values3 As Integer() = {} ' Noncompliant
|
|
Dim Values4() As Integer = {} ' Noncompliant
|
|
End Sub
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,vbnet]
|
|
----
|
|
Public Sub Method()
|
|
Dim Values1 As Integer() = Array.Empty(Of Integer)
|
|
Dim Values2 As Integer() = Array.Empty(Of Integer)
|
|
Dim Values3 As Integer() = Array.Empty(Of Integer)
|
|
Dim Values4() As Integer = Array.Empty(Of Integer)
|
|
End Sub
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Replace this empty array with Array.Empty(Of TElement).
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|