Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Public Class Foo
Private Name As String = "foobar" ' Noncompliant
Public ReadOnly Property DefaultName As String = "foobar" ' Noncompliant
Public Sub New(Optional Value As String = "foobar") ' Noncompliant
Dim Something = If(Value, "foobar") ' Noncompliant
End Sub
End Class
Public Class Foo
Private Const Foobar As String = "foobar"
Private Name As String = Foobar
Public ReadOnly Property DefaultName As String = Foobar
Public Sub New(Optional Value As String = Foobar)
Dim Something = If(Value, Foobar)
End Sub
End Class
The following are ignored: