.NET Framework Classes


Now that we ve covered a bit of the motivation behind the framework, let s take a deeper look at the classes. Classes in the .NET Framework are divided into logical groups called namespaces . Most classes in the .NET Framework exist under a top-level namespace known as System . The root System namespace contains the basic data types in the framework, such as numbers , Booleans, Uniform Resource Identifiers (URI), strings, and objects, the base type from which all other classes in the framework derive. System also contains a broad array of second-level namespaces that represent the core functionality in the framework, such as eventing , infrastructure, interfaces, attributes, and exceptions.

System.* Namespaces Overview

There are two general groups of classes in the .NET Framework: general-purpose base class libraries and application model “specific classes. It s useful to understand the difference between the two so that you ll better know when to use classes from each group as you build your application.

General-Purpose Class Libraries

General-purpose class libraries can be useful in almost any context. For example, System.String represents an immutable fixed-length string of Unicode characters . String manipulation is useful in a Web-based application that returns HTML content to the browser, a GUI client application that runs on the end user s computer, or a long-running service that has no graphical representation at all.

Table 1-1 contains System namespaces along with a brief description and an indication of whether the namespace represents a general-purpose base class library or is part of a particular application model. Each namespace contains anywhere from 10 to more than 100 classes, depending on the number of lower-level namespaces it contains.

Table 1-1: Second-Level System Namespaces*

Namespace

Description

Base Class or Application Model

CodeDom

Classes that can be used to reference the structure of a code document

Base

Collections

Contains interfaces and classes that define various collections of objects, such as lists, queues, bit arrays, hash tables, and dictionaries

Base

ComponentModel

Provides classes that are used to implement the run- time behavior of components and controls

Base

Configuration

Provides classes and interfaces that allow you to programmatically access .NET Framework configuration settings and handle errors in configuration files (.config files)

Base

Data

Contains the classes that represent ADO.NET, which enables you to build components that efficiently manage data

Base

Diagnostics

Provides classes that enable you to interact with system processes, event logs, and performance counters

Base

DirectoryServices

Provides easy access to Active Directory directory services from managed code

Base

Drawing

Provides access to GDI+ basic graphics functionality

Base

EnterpriseServices

Provides an important infrastructure for enterprise applications, including access to COM+

Base

Globalization

Contains classes that define culture- related information, including the language; the country/region; the calendars in use; the format patterns for dates, currency, and numbers; and the sort order for strings

Base

IO

Contains types that allow synchronous and asynchronous reading and writing on data streams and files

Base

Management

Provides access to a rich set of management information and management events about the system, devices, and applications designed for the Windows Management Instrumentation (WMI) infrastructure

Base

Messaging

Provides classes that allow you to connect to, monitor, and administer message queues on the network and send, receive, or peek messages

Base

Net

Provides access to network resources over protocols such as Transmission Control Protocol (TCP), User Datagram Protocol (UDP), and Hypertext Transfer Protocol (HTTP)

Base

Reflection

Contains classes and interfaces that provide a managed view of loaded types, methods , and fields, with the ability to dynamically create and invoke types

Base

Resources

Provides classes and interfaces that allow developers to create, store, and manage various culture-specific resources used in an application

Base

Runtime

Includes a broad set of third-level namespaces such as a Win32 interoperability layer, remoting, and object serialization

Base

Security

Provides the underlying structure of the CLR security system, including base classes for permissions

Base

ServiceProcess

Provides classes that allow you to implement, install, and control Windows service applications

Application model

Text

Contains classes representing ASCII, Unicode, UTF-7, and UTF-8 character encodings; abstract base classes for converting blocks of characters to and from blocks of bytes; and a helper class that manipulates and formats String objects without creating intermediate instances of String

Base

Threading

Provides classes and interfaces that enable multithreaded programming

Base

Timers

Provides classes that allow you to raise an event on a specified interval

Base

Web

Supplies classes and interfaces that enable the browser/ server communication used by ASP.NET

Application model

Windows.Forms

Contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system

Application model

Xml

Provides standards-based support for processing XML

Base

*Based on the .NET Framework Class Library overview at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemNet.asp.

As you can tell from Table 1-1, the .NET Framework contains a broad set of functionality.

Application Model “Specific Classes

Think of an application model as a set of classes that define a manner in which an application operates. They define the general structure of the application. The following sections provide a brief look at the application models in the .NET Framework.

ASP.NET

ASP.NET, contained in the System.Web namespace, is designed to make it easy for developers to build real-world Web applications. It offers a rich application environment for building server-side HTTP applications that dynamically create content and send it to a client, such as a browser or a mobile device.

Using ASP.NET and the base class libraries in the framework designed for distributed application development, you can build applications that gather data from multiple back-end or remote sources and present it to the browser in an aggregated format. The following example demonstrates an ASP.NET page that calls an XML-based Web service using the .NET Framework.

This weather service sample application is extremely simple. It takes a postal code as an input parameter and returns the forecast. In this case, it always returns sunny unless the zip code supplied is 11111 , in which case it will say rainy , as shown in Figure 1-2. The following code listing shows the code for this application:

Weather Service Sample Application ”Visual Basic .NET
 <%@WebServiceLanguage="VB Class="WeatherService %> ImportsSystem ImportsSystem.Web.Services 


Network Programming for the Microsoft. NET Framework
Network Programming for the MicrosoftВ® .NET Framework (Pro-Developer)
ISBN: 073561959X
EAN: 2147483647
Year: 2003
Pages: 121

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net