Documente Academic
Documente Profesional
Documente Cultură
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
D
The .NET Framework includes an extensive collection of prebuilt class files. These have
been grouped together in meaningful namespaces and published to the .NET Class Li-
brary. It would fill the entire book if we were to cover every class and namespace here.
However, that is not our purpose. What we will attempt to do is document some of the
more common and possibly more useful classes in the library.
Keep in mind that any class you select from the class library can be used in any of the
.NET programming languages, so, in effect, this appendix is pertinent to all of the lan-
guages included in .NET, such as Visual Basic .NET, JScript .NET, and so on.
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:40 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
using System;
This code tells the compiler that you may be using one or more of the different types in
the System namespace.
There are many ways to access the documentation for .NET Library types. We will talk
about two of the ways. First, within the Visual Studio .NET development environment is
a large documentation and help subsystem. Figure D-2 shows the root of the .NET Class
Library help structure. The best way to find it is by typing Class Library in the Look For
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:41 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
TIP You can add the web page to your list of favorites by selecting View |
Other Windows and Favorites from the menus. If you are anything like us,
you will find this page extremely helpful as you become familiar with the
classes available to you.
By selecting one of the namespaces shown in Figure D-3, you will find that you are
able to see all of the classes within that namespace.
There is another way to find help on the .NET Class Library, and that is by using
Microsoft’s MSDN web site at http://msdn.microsoft.com. Currently, the page that you
saw in Figure D-2 is also on Microsoft’s site (see Figure D-4).
Whichever method you choose when accessing the documentation, you will find
that Microsoft has spent a fair bit of time in making sure that the information is avail-
able to you and is easily readable.
PART VII
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:41 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:41 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
PART VII
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:42 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
using System;
class Rounding
{
public static void Main()
{
Console.WriteLine (Math.Round(12.42));
}
}
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:42 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
Console.WriteLine (Math.Round(12.42));
Most of the utility methods in the System class will operate in a similar fashion.
If you wish to dig deeper into the documentation, you can select any of the links for
the overloaded methods. We chose the first one to demonstrate:
PART VII
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:42 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:42 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
System.Data Namespace
You will find in the System.Data namespace a lot of classes that make up part of
PART VII
the ADO.NET structure. This allows you to manipulate data from many different
sources. ADO follows a concept of universal data access and provides tools to access,
update, and connect to data in any location. For more information on ADO.NET,
please review Chapter 10 on basic data access. Table D-2 lists some of the classes
found in this namespace.
There are many classes, interfaces, delegates, and enumerations available within the
System.Data namespace. For example, in the following list, you will see the inheritance
structure of the classes in the System.Data namespace. You can use this as a reference
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:42 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
to the classes that are available in the namespace. Although this is a long list, for the pur-
poses of the three Microsoft exams, you should become familiar with this namespace.
System.Object
System.Attribute
System.ComponentModel.DescriptionAttribute
System.Data.DataSysDescriptionAttribute
System.Collections.Hashtable
System.Data.PropertyCollection
System.ComponentModel.MarshalByValueComponent
System.Data.DataColumn
System.Data.DataSet
---- System.ComponentModel.IListSource,
System.ComponentModel.ISupportInitialize,
System.Runtime.Serialization.ISerializable
System.Data.DataTable
---- System.ComponentModel.IListSource,
System.ComponentModel.ISupportInitialize,
System.Runtime.Serialization.ISerializable
System.Data.DataView
---- System.ComponentModel.IBindingList,
System.Collections.IList,
System.Collections.ICollection,
System.Collections.IEnumerable,
System.ComponentModel.ITypedList,
System.ComponentModel.ISupportInitialize
System.Data.DataViewManager
---- System.ComponentModel.IBindingList,
System.Collections.IList,
System.Collections.ICollection,
System.Collections.IEnumerable,
System.ComponentModel.ITypedList
System.Data.Constraint
System.Data.ForeignKeyConstraint
System.Data.UniqueConstraint
System.Data.DataRelation
System.Data.DataRow
System.Data.DataRowView
---- System.ComponentModel.ICustomTypeDescriptor,
System.ComponentModel.IEditableObject,
System.ComponentModel.IDataErrorInfo
System.Data.DataViewSetting
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:43 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
System.Data.DataRowState
System.Data.DataRowVersion
System.Data.DataViewRowState
System.Data.DbType
System.Data.IsolationLevel
System.Data.MappingType
System.Data.MissingMappingAction
System.Data.MissingSchemaAction
System.Data.ParameterDirection
System.Data.PropertyAttributes
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:43 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
TIP You would be wise to investigate this namespace thoroughly before writing
the Microsoft exams. Although you will find the testing more specific to data
access within the Web or Windows Forms, you will still need to have a good
understanding of ADO.NET, the architecture for which the System.Data
namespace was built.
System.Web.UI Namespace
Just as the classes for ADO.NET were encapsulated inside of the System.Data namespace,
you will find the classes and interfaces for ASP.NET server controls and pages inside the
System.Web.UI namespace. These classes will allow you to create the user interface com-
ponents for your web applications. You will discover classes that provide server controls,
user controls, data binding, web page state management, and a lot more here. Table D-3
lists a few of the classes to be found in System.Web.UI.
The use of this namespace is discussed in an entire part of this book, Part III. You will
need to understand it for the web application exam.
Class Purpose
Control Contains properties, methods, and events that are shared by all ASP.NET
server controls.
DataBinding Creates data-binding expressions at design time within Visual Studio
.NET.
HtmlTextWriter Writes a sequential series of HTML-specific characters and text on a
Web Forms page.
Page Represents an .aspx file.
StateBag Represents the state of server controls in terms of their view state.
UserControl Represents the .ascx file when it is called from an .aspx file.
Table D-3 Some of the Classes Within the System.Web.UI Namespace
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:43 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter D
• Controls You will find text boxes, combo boxes, labels, lists, buttons, and the
like in this grouping.
• Control, User Control, and Form Control is base class for all the controls
on a Windows form. The form allows you to create dialog boxes, windows, and
so on, and the user control is there so that you can create custom controls that
are made up of other controls.
• Common Dialog Boxes If you want to represent the common file-open,
file-print, font, and other dialog boxes, you will find a lot of useful classes in
this section of the namespace.
• Components You will find menus, help, tool tips, and the like here.
As we mentioned, this is a very large namespace, and as such, is better viewed within
the documentation. Part IV of this book explores several of the classes found in the
System.Windows.Forms namespace. As with System.Web.UI, you will need to
know these classes for the exam, so we have devoted a full part of the book to them.
Summary
This has been a brief introduction to the .NET Class Library. Hopefully you now have an
appreciation for the amount of work that has been done by the developers of the library,
to help you spend more time on your business problems. We recommend that you dig
around the documentation a bit in order to become more familiar with the classes in the
different namespaces.
PART VII
P:\010Comp\All-in-1\443-6\appd.vp
Monday, August 26, 2002 11:57:43 AM