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

image

image

Listing 13.5 shows a particular implementation of the Person class, which exposes the FirstName, LastName, and Email properties. It implements the IFormattable interface that offers a new overload of the

Get Visual Basic® 2010 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.