For the sake of backward compatibility, Visual Basic .NET continues to offer a set of functions that convert from Object to different primitive types: ``++CChar, CStr, CBool, CDate, CSng, CDbl, CDec, CByte, CSByte, CShort, CUShort, CInt, CUInt, CLng, CULng++``. However, using these functions is misleading, because it suggests a cast. It is better to cast explicitly using ``++CType()++``, or use ``++Convert.To()++`` when the value should be converted. == Noncompliant Code Example [source,vbnet] ---- Public Class Foo Public Sub Bar(value as Object) Dim stringValue As String = CStr(value) End Sub End Class ---- == Compliant Solution [source,vbnet] ---- Public Class Foo Public Sub Bar(value as Object) Dim stringValue As String = CType(value, String) End Sub End Class ---- ifdef::env-github,rspecator-view[] ''' == Comments And Links (visible only on this page) include::comments-and-links.adoc[] endif::env-github,rspecator-view[]