Customized formater for Integer : IFormattable « Development « VB.Net Tutorial






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  = -252645135   

        converted =  Convert.ToString( Int32A, provider )
        Console.WriteLine( "Int32    {0}", converted )

    End Sub
End Module








7.13.IFormattable
7.13.1.Implement IFormattable
7.13.2.The IFormattable Interface
7.13.3.Customized formater for Integer