Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic
Public Class DummyProvider
Implements IFormatProvider
Public Function GetFormat( argType As Type ) As Object _
Implements IFormatProvider.GetFormat
Console.Write( "{0,-40}", argType.ToString( ) )
Return Nothing
End Function
End Class
Module MainClass
Sub Main( )
Dim provider As New DummyProvider( )
Dim converted As String
Dim Int32A As Integer = -1111111
Dim DoubleA As Double = 6.3
Dim ObjDouble As Object = CType( -98765.4321, Object )
Dim DayTimeA As DateTime = new DateTime( 2010, 9, 1, 13, 45, 0 )
Dim BoolA As Boolean = True
Dim StringA As String = "Qwerty"
Dim CharA As Char = "$"c
Dim TSpanA As TimeSpan = New TimeSpan( 0, 18, 0 )
Dim ObjOther As Object = CType( provider, Object )
converted = Convert.ToString( Int32A, provider )
Console.WriteLine( "Int32 {0}", converted )
converted = Convert.ToString( Int32A, provider )
Console.WriteLine( "Int32 {0}", converted )
converted = Convert.ToString( DoubleA, provider )
Console.WriteLine( "Double {0}", converted )
converted = Convert.ToString( ObjDouble, provider )
Console.WriteLine( "Object {0}", converted )
converted = Convert.ToString( DayTimeA, provider )
Console.WriteLine( "DateTime {0}", converted )
converted = Convert.ToString( BoolA, provider )
Console.WriteLine( "Boolean {0}", converted )
converted = Convert.ToString( StringA, provider )
Console.WriteLine( "String {0}", converted )
converted = Convert.ToString( CharA, provider )
Console.WriteLine( "Char {0}", converted )
converted = Convert.ToString( TSpanA, provider )
Console.WriteLine( "TimeSpan {0}", converted )
converted = Convert.ToString( ObjOther, provider )
Console.WriteLine( "Object {0}", converted )
End Sub
End Module