.NET Framework Classes C# Help

Perhaps one of the biggest benefits of writing managed code, at  east from a developer’s point of view, is that you get to use the .NET base class library.

The .NET base classes are a massive collection of managed code classes that allow you to do almost any of the tasks that were previously available through the Windows API. These classes Wllow the same object model that IL uses, based on single inheritance. This means that you can either instantiate objects of whicheve~ .NET base class is appropriate 6r derive your own classes from  them.

The great thing about the .NET base classes is that they have been designed to be very intuitive and easy to use. For example, to start a thread, you call the Start () method of the Thread class. To disable a TextBox, you Set the. Enabl ed property of a TextBox object to false. This approach – though familiar to visual Basic and Java developers, whose respective libraries are just as easy to use – will be a welcome relief to C++ developers, who for years have had to cope with such API functions as Get Digits ( I, RegisterWndClassEx (), and IsEqualIID (), as well as a whole plethora of functions that required Windows handles to be passed around.

However, C++ developers always had easy access to the entire Windows API, unlike Visual Basic 6 aria Java developers who were more restricted in terms of the basic operating system functionality that they have access to from their respective languages. What is new about the .NET base classes is that they combine the ease of use that was typical of the Visual Basic and Java libraries with the relatively
comprehensive coverage of the Windows API functions. Many features of Windows still are not available through the base classes, and for those you will need to call into the AlI functions, but in   general, these
are now confined to the more exotic features. For·everyday use, you will probably find the base classes adequate. Moreover, if you do need to call into an API function, .NET offers a so-called platform-invoke that ensures data types are correctly converted, so the task is no harder than calling the function directly from c++ code would have been – regardless of whether you are coding in C#, c++, or VISual Basic 2008.

WinCV, a Windows-based utility, can be used to browse the  classes, structs, interfaces, and enums in the base class library.

Although Chapter 3 is nominally dedicated to the subject of base classes, once we have completed our coverage of the syntax of the C# language, most of the rest of this book shows you how to use various classes within the .NET base class library for the .NET Framework 3.5. That is how comprehensive base classes are. As a rough guide, the areas covered by the .NET 3.5 base classes include:

  •  Core features provided by IL (including the primitive data types in the CTS .
  • Windows GUI support and controls.
  •  Web Forms.
  •  Data access.
  •  Directory access.
  •  Networking and Web browsing.
  • .NET attributes and reflection.
  • COM interoperability.

Incidentally, according to Microsoft sources, a large proportion of the .NET base classes have actually been written in C#.

Posted on October 27, 2015 in .NET Architecture

Share the Story

Back to Top