The Microsoft .NET Platform currently offers built-in support for
three languages: C#, Visual Basic, and JScript.
C#.NET
C#.NET .NET
has many new and improved language features such as inheritance, interfaces,
and overloading — that make it a powerful object-oriented programming language.
As a C#.NET developer, you can now create multithreaded, scalable applications
using explicit multithreading. Other new language features in C#.NET .NET
include structured exception handling, custom attributes, and common language
specification (CLS) compliance.
The CLS is a set
of rules that standardizes such things as data types and how objects are
exposed and interoperate. C#.NET .NET adds several features that take advantage
of the CLS. Any CLS-compliant language can use the classes, objects, and
components you create in C#.NET .NET. And you, as a C#.NET user, can access
classes, components, and objects from other CLS-compliant programming languages
without worrying about language-specific differences such as data types. CLS
features used by C#.NET .NET programs include assemblies, namespaces, and
attributes.
C#.NET .NET supports many new
or improved object-oriented language features such as inheritance, overloading,
the Overrides keyword,
interfaces, shared members, and constructors. Also included are structured
exception handling, delegates, and several new data types.
Inheritance
C#.NET .NET supports inheritance by
allowing you to define classes that serve as the basis for derived classes.
Derived classes inherit and can extend the properties and methods of the base
class. They can also override inherited methods with new implementations. All
classes created with C#.NET .NET are inheritable by default. Because the forms
you design are really classes, you can use inheritance to define new forms
based on existing ones.
Exception
Handling
C#.NET .NET supports structured
exception handling, using an enhanced version of the Try...Catch...Finally syntax supported
by other languages such as C++. Structured exception handling combines a modern
control structure (similar to Select
Case or While) with
exceptions, protected blocks of code, and filters. Structured exception
handling makes it easy to create and maintain programs with robust,
comprehensive error handlers.
OVerloading
Overloading is
the ability to define properties, methods, or procedures that have the same
name but use different data types. Overloaded procedures allow you to provide
as many implementations as necessary to handle different kinds of data, while
giving the appearance of a single, versatile procedure.
Overriding Properties
and Methods
The Overrides keyword allows derived
objects to override characteristics inherited from parent objects. Overridden
members have the same arguments as the members inherited from the base class, but
different implementations. A member's new implementation can call the original
implementation in the parent class by preceding the member name with My Base.
Constructors
and Destructors
Constructors
are procedures that
control initialization of new instances of a class. Conversely, destructors
are methods that free system resources when a class leaves scope or is set to nothing. C#.NET .NET supports
constructors and destructors using the Sub
New and Sub Finalize
procedures. For details, see Object Lifetime: How Objects are Created and
Destroyed.
Data Types
C#.NET .NET introduces
three new data types. The Char
data type is an unsigned 16-bit quantity used to store Unicode characters. It
is equivalent to the .NET Framework System.
Char data type. The Short
data type, a signed 16-bit integer, was named Integer in earlier versions of C#.NET. The Decimal data type is a 96-bit signed integer scaled by a variable
power of 10. In earlier versions of C#.NET, it was available only within a Variant.
Interfaces
Interfaces describe the properties and methods
of classes, but unlike classes, do not provide implementations. The Interface statement allows you to
declare interfaces, while the Implements
statement lets you write code that puts the items described in the interface
into practice.
Delegates
Delegates — objects that can call the methods
of objects on your behalf — are sometimes described as type-safe, object-oriented
function pointers. You can use delegates to let procedures specify an event
handler method that runs when an event occurs. You can also use delegates with
multithreaded applications.
Shared
Members
Shared members are properties, procedures, and
fields that are shared by all instances of a class. Shared data members are
useful when multiple objects need to use information that is common to all.
Shared class methods can be used without first creating an object from a class.
References
References allow you to use objects defined in other assemblies.
In C#.NET .NET, references point to assemblies instead of type libraries.
Namespaces
Namespaces prevent naming conflicts by organizing classes,
interfaces, and methods into hierarchies.
Assemblies
Assemblies replace and extend the capabilities
of type libraries by, describing all the required files for a particular
component or application. An assembly can contain one or more namespaces.
Attributes
Attributes enable you to provide additional
information about program elements. For example, you can use an attribute to
specify which methods in a class should be exposed when the class is used as a
XML Web service.
Multithreading
C#.NET .NET allows you to
write applications that can perform multiple tasks independently. A task that
has the potential of holding up other tasks can execute on a separate thread, a
process known as multithreading. By causing complicated tasks to run on
threads that are separate from your user interface, multithreading makes your
applications more responsive to user input.
ADO.NET
As you develop
applications using ADO.NET, you will have different requirements for working
with data. In some cases, you might simply want to display data on a form. In
other cases, you might need to devise a way to share information with another
company.
No
matter what you do with data, there are certain fundamental concepts that you
should understand about the data approach in ADO.NET. You might never need to
know some of the details of data handling — for example, you might never need
to directly edit an XML file containing data — but it is very useful to
understand the data architecture in ADO.NET, what the major data components
are, and how the pieces fit together.
This introduction presents a high-level
overview of these most important concepts. The topic deliberately skips over
many details — for example, there is much more to datasets than what is
mentioned here — in favor of simply introducing you to ideas behind data
integration in ADO.NET.
ADO.NET Does Not Depend
on Continuously Live Connections In traditional client/server applications,
components establish a connection to a database and keep it open while the
application is running. For a variety of reasons, this approach is impractical
in many applications.
Open
database connections take up valuable system resources. In most cases,
databases can maintain only a small number of concurrent connections. The
overhead of maintaining these connections detracts from overall application
performance.
Similarly, applications that
require an open database connection are extremely difficult to scale up. An
application that does not scale up well might perform acceptably with four
users but will likely not do so with hundreds. ASP.NET Web applications in
particular need to be easily scalable, because traffic to a Web site can go up
by orders of magnitude in a very short period.
A model based on always-connected
data can make it difficult and impractical to exchange data across application
and organizational boundaries using a connected architecture. If two components
need to share the same data, both have to be connected, and a way must be
devised for the components to pass data back and forth.
For all these reasons, data access
with ADO.NET is designed around an architecture that uses connections
sparingly. Applications are connected to the database only long enough to fetch
or update the data. Because the database is not holding on to connections that
are largely idle, it can service many more users.
0 comments:
Post a Comment