Prev | Current Page 277 | Next

Guy Fouch?©, Trey Nash

"Accelerated VB 2008"

Each CultureInfo instance contains specific instances
of DateTimeFormatInfo, NumberFormatInfo, TextInfo, and CompareInfo that are germane to the
language and region represented.
Once the IFormattable.ToString() implementation has a valid format provider??”
whether it was passed in or whether it was the one attached to the current thread??”then it
may query that format provider for a specific formatter by calling the IFormatProvider.
GetFormat method. The formatters implemented by the .NET Framework are the
NumberFormatInfo and DateTimeFormatInfo types. When you ask for one of these objects
via IFormatProvider.GetFormat(), you ask for it by type. This mechanism is extremely
extensible because you can provide your own formatter types, and other types you create
that know how to consume them can ask a custom format provider for instances of them.
CHAPTER 9 n WORKING WITH STRINGS 170
Suppose you want to convert a floating-point value into a string. The execution flow of the
IFormattable.ToString() implementation on System.Double follows these general steps:
1. The implementation gets a reference to an IFormatProvider type, which is either the
one passed in or the one attached to the current thread if the one passed in is Nothing.
2. It asks the format provider for an instance of the type NumberFormatInfo via a call to
IFormatProvider.


Pages:
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
wyciągarki hotele londyn Wczasy nad morzem sklep modelarski Okna PCV Wrocław