$ (Visual Basic Reference)

Identifies a string literal as an interpolated string. An interpolated string is a template-like string that contains literal text along with interpolated expressions. When the interpolated string is resolved, for example in an assignment statement or a method call, its interpolated expressions are replaced by their string representations in the result string. Interpolated strings are replacements for the composite format strings supported by the .NET Framework.

The following example uses the $ character to define an interpolated string.

Public Module Example
   Public Sub Main()
      Dim name = "John"
      Dim greeting = $"Hello, {name}!"
   End Sub
End Module
' The example displays the following output:
'       Hello, John!

For more information on interpolated strings, see the Interpolated Strings topic.

See also