The String Extension Methods
As mentioned earlier,
String
implements
IEnumerable
. This means that beginning with
C# 3.0, a
String
object can call the extension methods defined by
Enumerable
and
Queryable
,
which are both in the
System.Linq
namespace. These extension methods primarily provide
support for LINQ, but some can also be used for other purposes, such as certain types of
string handling. See Chapter 19 for a discussion of extension methods.
Formatting
When a human-readable form of a built-in type, such as
int
or
double
, is needed, a string
representation must be created. Although C# automatically supplies a default format for this
representation, it is also possible to specify a format of your own choosing. For example, as you
saw in Part I, it is possible to output numeric data using a dollars and cents format. A number
www.freepdf-books.com
Do'stlaringiz bilan baham: |