. NET Framework Namespaces
What is a namespace? If Microsoft had simply provided a list of several
Thousand classes, attempting to find or work with any specific class wowould
Be next to impossible. Although were speculating, Microsoft might have
Ended up using class names such as SystemDataOleDbDataSet and
SystemTheadingThread. Long names wocould be required in order to provide some
Sort of groupings and perspective.
Instead, Microsoft chose to group the varous classes into a hierarchical
Set of namespaces. Using a syntax that separates levels in the hierarchy
With dots, youll find yourself referring to classes like this:
System. Data. OleDb. OleDbDataReader
In this example, the. NET Framework provides a System namespace,
System. Data namespace, and a System. Data. OleDb namespace. Each provides
Set of classes, and the OleDbDataReader class is a part of
System. Data. OleDb namespace.
Imagine this scenario: Youd like to send a letter to a friend named Tom
Who lives users ss the country, and you address an envelope to Tom (just
"Tom"), slap on a stamp, and drop it into a mailbox. Whats the chance that
The letter will get to your friend? Next to none. If the U. S. Postal
Service had assigned each of us a local "namespace" consisting
Postalcode. state. city. streetaddress, then you might address your letter
90012. ca. los angeles.123 Smith Street and have it reach your friend.
Microsoft faced the same sort of issue when developing the. NET Framework.
Therefore, each class belongs to a single namespace, and youll use
. NET Framework documentation to investigate the varous classes and
Namespaces.
You are probably asking yourself, which namespaces will I use most often?
This chapter discusses those namespaces you might utilize for typical Web-
Or Windows-based business applications. This chapter will not (nor cocould
It) provide a full reference of every available namespace provided hat wocould take
Several books itself.
The task of limiting the classes to be discussed in this chapter was
Daunting provided here are well over 1,000 classes provided by the. NET Framework.
We decided to focus on classes that youre likely to use in applications
That take advantage of Windows Forms, Web Forms, Web Services, databases,
And XML. By using these rather broad areas as the basis for choosing
Namespaces, the list of classes weve defined ded is large but not
Overwhelming. Once you understand some of these objects, working with other
Objects is easier.
Heres a list of the namespaces covered in this chapter:
System
System. Data
System. Data. OleDb
System. Data. SqlClient
System. IO
System. Text
System. Collections
System. Web. Services
System. Windows. Forms
System. Xml
Although this seems like quite a lot of classes to cover, well only
Provide a brief introduction to them in this chapter. You will find more
Coverage of limitations of these namespaces in later chapters in the book.
TIP
In order to follow along with the discussion in this chapter, you can load
The JumpstartFrameworkClassesFrameworkClasses. sln solution into Visual
Studio. NET.