Thursday, October 23, 2008

Introduction to the .NET Base Classes


The .NET Base Classes are the means by which you can access much of the core functionality of Windows, as well as perform operations such as data access from .NET code. It consists of a huge number of classes that Microsoft have written to carry out these operations, and which you can call in your code. You can even write classes that inherit from the base classes.

What's a .NET class?

If you've not encountered the term before you may wonder exactly what a .NET class is. This is only an introductory article, so we won't give an exact definition here, but depending on your previous programming experience you can think of it as follows:
For C++ Developers: Think of a .NET class as like a C++ class, except that it's packaged up in a way that means you can easily call it up or inherit from it in any .NET-aware language, including C++, VB and C#.
For VB Developers: Think of a .NET class as like an ActiveX control (with or without a user interface), but which is a lot easier to use. You can also inherit from a .NET class, which means you can write your own class that is based on it, but in which you override the implementations of some methods.

What Do the Base Classes Do?

The number of base classes is huge, so there's no way that we can cover everything here. But here's a quick summary of the kind of things that can be done with them.


» Strings. String handling.
» Collections and Arrays. There are all sorts of permutations for storing sets of objects: Arrays, Lists, Maps, Linked lists. All implemented in highly efficient ways.
» WinForms. Classes to display windows and controls - text boxes, combo boxes, listboxes, file dialogs etc., and to react to events on those controls (Windows messages in low-level C++ parlance).
» WebForms. Classes that do roughly the same as many of the WinForms classes, but are designed to work over the Internet: Instead of creating the relevant control, they generate all the HTML needed to get a web browser to display something that looks and behaves like the control in question. You can use WebForms in your ASP.NET pages.
» File Handling. You can use .NET base classes to navigate around the file system on your machine or network, to check the properties of files, read, modify and write to files, and move and copy files and folders around.
» Registry Access. Base classes are available that allow you to navigate, read, and modify the contents of the registry.
» Internet. Using the base classes you can connect to the Internet and download and upload files.
» ADO.NET. The ADO.NET classes allow you to connect to a data source and read or modify it - much the same abilities as are offered by the existing ADO, except that ADO.NET is designed much more around the concept of disconnected data, and makes heavy use of XML for data transmission.

There's a lot more than this available, but this taster should give you an idea.

No comments: