Complete-Reference-Vb Net 11
Complete-Reference-Vb Net 11
• System.String The class that represents an immutable series of characters represented in the value of
the String reference object. This is the base String storage and manipulation object, a type that
behaves and is constructed like a fixed array of characters. The String's members provide you with
the tools to operate on a series of characters in every conceivable way. Because the String's value is
immutable, changes to the String are stored in its clone or copy, which then becomes the new String.
• System.Text A namespace that encapsulates classes like StringBuilder, which is a mutable series of
characters. Unlike String, it lets you add to and change the original value, in chunks or one character
at a time. The StringBuilder class is a powerful utility. You saw it in action in Chapter 5, in the
"Shifting Bits" section. We discuss it in more detail in this chapter.
• System.Text.RegularExpressions A namespace that represents classes for creating and processing
regular expressions. Regular expressions provide a powerful, flexible, and efficient model for
processing text.
• System.IO An extensive namespace that encapsulates classes for all manner of file operations, IO,
.NET's support for streams, and so on. It also caters to readers and writers, where methods such as
Read, Write, ReadLine, and WriteLine originate.
• System.Xml A namespace that represents the core XML processing classes. Specifically, we are
going to discuss the XML classes that provide core XML text reading and writing functionality. The
specifics of XML constructs and concepts such as documents, schemas, paths, and transformations are
beyond the scope of this book (in fact, .NET's support for XML is so extensive that it is probably
beyond the scope of any book).
Let's start with the construct we are probably the most familiar with, the String class.
Instantiating and initializing a String object is easy in Visual Basic .NET. The Framework provides an
immutable string−handling class, which is found at the System.String namespace. While String is a reference
type, it behaves a lot like one of the fundamental data types, such as Decimal or Integer, common in the
non−OOP environments. When you need an instance of String, you do not need to provide the New keyword
because you do not have access to the constructor of the object.
There have been many examples of creating and initializing String objects in this book, so if you've been
reading the chapters in sequence, no doubt you already know how to declare and use an instance of String
with an initial value. The following code instantiates the String object and initializes its value field
(ToString) with a string:
The String class is an immutable type, which means that any operations performed on the String return a
newseemly modifiedversion of the String rather than the original instance. By making String an immutable
type, it can be very efficient to work with. We'll look at the StringBuilder class later in this chapter when we
explore working with mutable string−like structures. You can also easily convert the String object to objects
of other fundamental types, such as Char and Byte. (Refer to Chapter 4 for more information on conversion.)
495