C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Finally: It converts the Char (a) into the String "a". It uses the CStr function for this as well.
StringsVB.NET program that uses CStr function
Module Module1
Sub Main()
' Convert integer to string.
Dim str As String = CStr(5)
If str = "5" Then
Console.WriteLine(str)
End If
' Convert bool to string.
str = CStr(True)
If str = "True" Then
Console.WriteLine(str)
End If
' Convert char to string.
str = CStr("a"c)
If str = "a" Then
Console.WriteLine(str)
End If
End Sub
End Module
Output
5
True
a
Note: The CStr("a"c) call above is optimized out by the Visual Basic .NET compiler for better performance.
Also: We noted how the CStr function is implemented in the .NET Framework internals.