The previous
code accepts a string on the command line, and then creates a new instance from it using the
String.Intern method. This method always returns a valid string reference, but it will either
be a string instance referencing a string in the intern pool, or a new string copy based upon
the passed-in value.
Format Specifiers and Globalization
You often need to format the data that an application displays to users in a specific way. For
example, you may need to display a floating-point value representing some tangible metric in
exponential form or in fixed-point form. If in fixed-point form, you may need to use a culturespecific
character, such as the decimal mark. The .NET BCL offers powerful mechanisms for
handling these two notions in a flexible and extensible manner. However, before we can get
into the topic of format specifiers themselves, let??™s cover some preliminary topics.
nNote It??™s important to address any cultural concerns and globalization requirements your software may
have early in the development cycle. The .NET designers put a lot of work into creating a rich library for handling
globalization, though the richness and breadth of the globalization API indicates how difficult it can be.
Object.ToString(), IFormattable, and CultureInfo
Every object inherits a method from System.
Pages:
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286