The Assembly/Namespace/Type Distinction (Web hosting uk) Each of us understands the

The Assembly/Namespace/Type Distinction Each of us understands the importance of code libraries. The point of libraries such as MFC, J2EE, and ATL is to give developers a well-defined set of existing code to leverage in their applications. However, the C# language does not come with a language-specific code library. Rather, C# developers leverage the language-neutral .NET libraries. To keep all the types within the base class libraries well organized, the .NET platform makes extensive use of the namespace concept. Simply put, a namespace is a grouping of related types contained in an assembly. For example, the System.IO namespace contains file I/O related types, the System.Data namespace defines basic database types, and so on. It is very important to point out that a single assembly (such as mscorlib.dll) can contain any number of namespaces, each of which can contain any number of types. To clarify, Figure 1-4 shows a screen shot of the Visual Studio 2005 Object Brower utility. This tool allows you to examine the assemblies referenced by your current project, the namespaces within a particular assembly, the types within a given namespace, and the members of a specific type. Note that mscorlib.dll contains many different namespaces, each with its own semantically related types. 22 CHAPTER 1 THE PHILOSOPHY OF .NET Figure 1-4. A single assembly can have any number of namespaces. The key difference between this approach and a language-specific library such as MFC is that any language targeting the .NET runtime makes use of the same namespaces and same types. For example, the following three programs all illustrate the ubiquitous Hello World application, written in C#, VB .NET, and Managed Extensions for C++: // Hello world in C# using System; public class MyApp { static void Main() { Console.WriteLine(”Hi from C#”); } }
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Leave a Reply