top of page


Public·10 members

Namespace Within The Net Framework Class Library

This naming scheme makes it easy for library developers extending .NET to create hierarchical groups of types and name them in a consistent, informative manner. It also allows types to be unambiguously identified by their full name (that is, by their namespace and type name), which prevents type name collisions. Library developers are expected to use the following convention when creating names for their namespaces:

namespace within the net framework class library

The use of naming patterns to group related types into namespaces is a useful way to build and document class libraries. However, this naming scheme has no effect on visibility, member access, inheritance, security, or binding. A namespace can be partitioned across multiple assemblies and a single assembly can contain types from multiple namespaces. The assembly provides the formal structure for versioning, deployment, security, loading, and visibility in the common language runtime.

The System namespace is the root namespace for fundamental types in .NET. This namespace includes classes that represent the base data types used by all applications, for example, Object (the root of the inheritance hierarchy), Byte, Char, Array, Int32, and String. Many of these types correspond to the primitive data types that your programming language uses. When you write code using .NET types, you can use your language's corresponding keyword when a .NET base data type is expected.

In addition to the base data types, the System namespace contains over 100 classes, ranging from classes that handle exceptions to classes that deal with core runtime concepts, such as application domains and the garbage collector. The System namespace also contains many second-level namespaces.

The Framework Class Library or FCL provides the system functionality in the .NET Framework as it has various classes, data types, interfaces, etc. to perform multiple functions and build different types of applications such as desktop applications, web applications, mobile applications, etc. The Framework Class Library is integrated with the Common Language Runtime (CLR) of the .NET framework and is used by all the .NET languages such as C#, F#, Visual Basic .NET, etc.

The functionality of the Framework Class Library can be broadly divided into three categories i.e utility features written in .NET, wrappers around the OS functionality and frameworks. These categories are not rigidly defined and there are many classes that may fit into more than one category.

Namespaces in the Framework Class Library are a group of related classes and interfaces that can be used by all the .NET framework languages. Some of the namespaces in the FCL along with their description is given as follows:

Contains fundamental classes and base classes that define common value and reference data types, events and event handlers, interfaces, processing exceptions, data conversion, mathematics, as well as garbage collection and application environment management. Some of the classes defined in the namespace are covered in this chapter and also in Chapters 4 and 5.

Provides classes that support asynchronous and synchronous reading from and writing to data streams and files. Contains classes like FileStream, MemoryStream, Path, and Directory. We will learn about this namespace and its classes in the next chapter.

Contains interfaces and classes that define various collections of objects, such as lists, arrays, hash tables, stacks, queues, and dictionaries. The classes defined in this namespace are covered in this chapter.

Serves as a base for ASP.NET applications. Contains such classes as HTTPRequest, HTTPResponse, and HTTPServerUtility. Child namespaces include Caching, Configuration, Security, and UI. We will discuss this namespace and its secondary namespaces in Chapters 6 and 7.

.NET Base Class Library is the sub part of the Framework that provides library support to Common Language Runtime to work properly. It includes the System namespace and core types of the .NET framework.

I have a doubt in creating class library in .net. I saw in one class library code that they didn't use the namespace in it. But still its compiled and run successfully when I use the method in other classes. So can you please tell me what is the advantage, disadvantage of it?

Namespace is like a book shelf in library you can store the books in the shelf so when you want a specific book you know where to look i.e imagine you need two classes in code like Home.cs and about.cs

I believe the OP is asking about the use of the "namespace" keyword in the class library file itself. If your class library file only contains a single class, the namespace keyword isn't necessary. You can just have your using statements at the top of the file and then the class definition itself, not enclosed in a namespace. If your library file contains more than one class definition, it's best to enclose those definitions in a namespace.

In order to work effectively in C# on the .NET platform, it is important to understand the general capabilities in the predefined class library. However, the library is far too large to cover completely in this book, as it encompasses approximately 3,540 types grouped into 124 namespaces and exported from 38 different assemblies.

The Framework class library (FCL) is a comprehensive collection of reusable types including classes, interfaces and data types included in the .NET Framework to provide access to system functionality.The .NET FCL forms the base on which applications, controls and components are built in .NET. It can be used for developing applications such as console applications, Windows GUI applications, ASP.NET applications, Windows and Web services, workflow-enabled applications, service oriented applications using Windows Communication, XML Web services, etc. The reusable types of FCL provide a simple interface to developers due to:

FCL is designed to provide services similar to the Windows application programming interface (API), which was used before .NET was created. FCL has its code base as managed, object-oriented and easy to use, while Windows API is unmanaged, modular and cumbersome to use.The .NET FCL is integrated with the Common Language Runtime (CLR) of the Framework, which manages the code execution. Its classes follow the object model as used by the Intermediate Language (IL) and are based on single inheritance. The classes and interfaces are grouped into namespaces so that they can be accessed easily. Namespaces represent a hierarchy of the defined types formed by a logical group of related classes and interfaces, which can be used by any language targeting the .NET framework. They reside in assemblies, which are deployable units containing details about classes, interfaces and structures. The first part up to the last dot of the full name of a type indicates the namespace, while the last part specifies the type name. This way of using namespaces avoids a naming conflict, which can arise if two class names are same. While "System" is the root namespace for fundamental types in .NET framework, "Object" forms the root for all objects.The classes and interfaces provide an option to use the functionality through implementation (in a concrete class considering it as a base) or only the signatures of methods defined in interface or abstract classes. When using Visual Studio for development of an application, the most common base classes are already referenced in the project, while the types not defined, such as user-defined types in a separate dynamic link library, have to be added explicitly so they can be used. The class servicing the needed functionality can be used in code by including an import directive for the namespace containing the class.Microsoft has also provided guidelines necessary to be adopted for library development, which extend and interact with the .NET Framework. These guidelines cover naming types and members in class libraries, using static and abstract classes, interfaces, members of type, exceptions, etc. Improper usage of the FCL library can adversely affect developer productivity and discourage its usage.FCL is similar to Java Foundation Classes. The main challenge in using FCL is to know the specific class that can provide the required functionality.

The sixteenth part of the C# Object-Oriented Programming tutorial describes the use of namespaces. Namespaces allow classes, structures and other items to be grouped and organised and remove the possibility of class-naming conflicts.

As programming languages have evolved, the frameworks around them have greatly increased in size. The .NET framework provides a huge number of base classes, data types, algorithms, etc. If every one of these items had to be declared with a unique name, the naming task would be equally large and would leave very few good names available for the .NET developer.

To ensure that naming conflicts do not occur, either within the .NET framework or in your own programs, namespaces are used. A namespace simply provides a named group of classes, structures, enumerations, delegates, interfaces and other namespaces. Within the namespace, all declared items must be uniquely named. However, the same name may be duplicated in different namespaces. This means that if you decide to create a mathematics library you will be able to call it 'Math' even though Microsoft have also provided a Math library.

All definitions are created in a namespace, even if one is not explicitly declared. The .NET framework provides the default namespace, which is used automatically for any code that is written outside of any namespace declaration. This can be useful for short programs but has the drawback that all of the benefits that namespaces bring to organising your code are lost.

To demonstrate the creation of a namespace we will create some code. To begin, create a new console application named "NamespaceDemo". If you are creating the project using Visual Studio, you will notice that the Program class that is automatically generated exists within a namespace that is also called "NamespaceDemo".


Welcome to the group! You can connect with other members, ge...
Group Page: Groups_SingleGroup
bottom of page