The IFormattable Interface

The IFormattable interface enables implementing a new overload of the ToString method to provide customized string formatting with deep control over the process, also defining custom qualifiers. Listing 13.5 shows how you can implement the IFormattable interface.

LISTING 13.5 Implementing the IFormattable Interface

Imports System.GlobalizationPublic Class Person    Implements IFormattable    Public Property FirstName As String    Public Property LastName As String    Public Property Email As String    Public Overloads Function ToString(format As String,                              formatProvider As System.IFormatProvider) _                              As String Implements System.IFormattable.ToString ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.