4.3 Using the FCL
“Give a man a fish and you feed him for a day. Teach a man to fish
and you feed him for a lifetime.” The IO stream example in the last section was like me giving you a fish. With the FCL it is much better to learn how to fish, because the Framework Class Library is so expansive and you will use it every time you write managed code. I am going to give you the necessary information for you to learn to learn about the Framework Class Library.
The following is a list of points about the FCL that will help you to learn to use the library.
· The many classes, interfaces, structures and enumerated types in the Framework Class Library are collectively referred to as types.
· The various types in the framework are arranged in a hierarchy of namespaces. This solves the problem of name collisions. But in day-to-day use namespace help programmers to find types that solve a certain kind of problem, and they can help programmers to find more than one type that deal with the same problem (such as IO types that live in the System.IO namespace).
· Namespaces themselves live in a hierarchy and are arranged as words separated by the period “.” character. From the CLR’s point of view a type’s name is its fully qualified name including namespaces. Therefore we may write code that uses a Stream class or a Form class, but in IL these types are represented as System.IO.Stream and System.Windows.Forms.Form respectively.
· Languages such as C# allow you to indicate which namespaces a specific source code file will be using. This way in the source code you can refer to the types in their abbreviated form. The first red source code line in Figure 4‑2 is an example of the using statement in C#. I added this line to the code to indicate to the compiler that the sources included types found in the System.Security.Cryptography namespace of the FCL. In this example these types were the CryptoStream, ToBase64Transform and CryptoStreamMode types.
· The System namespace is a good place to look for types that are useful across a wide number of different types of applications.
· All types must have a base class (including types that you define in your). The exception to this rule is the System.Object type which is the base type for all types in the system. (If you create a class that does not explicitly declare a base class then the compiler implicitly defines its base class to be Object).
· The facts in this list plus comfort with the .NET Framework SDK Documentation will really bootstrap your skills with managed code.
Popular Posts
-
1 Introducing the .NET Framework with C# The .NET Framework is such a comprehensive platform that it can be a little difficult to descr...
-
Additional Command Button's Properties Add 1 Command Button to your form, and change the following properties to see what they do. Capti...
-
This chapter talks about installing SQL Server Express. If you have a licensed version of full SQL Server 2005, you can follow the same step...
-
Introduction: In this exercise, you are going to build and run a sample Java program called Homework using NetBeans. The sample program can...
-
Introduction: In this exercise, you will exercise the concept object creation using new keyword. We will learn how you are going to create ...
-
In previous chapters, you learned to how to connect to SQL Server 2005 using management studio. In this chapter, you will learn how to creat...
-
Adding Controls to the Form There are many controls you can use with your program: Buttons, Text Boxes, Pictures, Scroll Bars and more. You ...
-
SYMBOLIC CONSTANTS OR MACRO: In this #define is a macro used for a constant value to be assigned in the program. for example: pi its value i...
-
Using functions we can structure our programs in a more modular way, accessing all the potential that structured programming can offer to us...
-
The SQL AVG aggregate function selects the average value for certain table column. Have a look at the SQL AVG syntax: SELECT AVG(Column1) FR...
No comments:
Post a Comment