BCA / B.Tech 17 min read

Assemblies & Class Libraries

Assemblies & Class Libraries in Hindi | Assemblies and Class Libraries in Hindi:


  • In the .NET Framework, Assemblies and Class Libraries are important components that are helpful in the structure, development, and reuse of an application.
  • In the .NET Framework, Assemblies and Class Libraries play an important role. Assemblies are a means of storing various components of an application in an organized form, and Class Libraries are a collection of those components
  • that are designed to be used repeatedly. The correct and effective use of both makes an application modular, reusable, and manageable.

Their use in various fields is to make code modular, manageable, and reusable. Let's understand them in detail.

Assemblies in Hindi | Assembly:

An Assembly is an important component of the .NET Framework. It is considered the basic building block of a .NET application. An assembly is a type of binary file that stores code, resources, and metadata in one place. Every program in .NET is stored in one or more assemblies, which helps in its execution.

Types of Assemblies in Hindi | Types of Assemblies:

There are mainly two types of assemblies in .NET:

  • Private Assembly: This is specially used by an application and is stored only in the local folder of that application. It cannot be used by any other application.
  • Shared Assembly: This is stored in the Global Assembly Cache (GAC) and can be used by more than one application. A Shared Assembly has a special identity called a Strong Name, which ensures the security and version control of the assembly.

Component of Assemblies in Hindi | Components of an Assembly:

An assembly has the following main components:

  • Manifest: Stores information about the assembly (such as name, version, culture, and Strong Name). It also provides information about all the files and resources of the assembly.
  • Type Metadata: This contains information about all the data types and members of the assembly.
  • Intermediate Language (IL) Code: This contains all the IL instructions that are converted into machine code by the JIT compiler at runtime.
  • Resources: Resource files such as images, audio, and other data files are stored in the assembly.

Advantages of Assemblies in Hindi | Advantages of Assemblies:

  • Reusability: The code stored in an assembly can be easily reused in other applications.
  • Version Control: Assemblies are helpful in managing version control, which can be easily updated when a new version is needed.
  • Security: Security is enhanced in Shared Assemblies by the use of Strong Naming and GAC.
  • Modularity: The use of assemblies helps in dividing an application into small modules, which makes it easy to understand, manage, and debug the code.

Examples of Assemblies in Hindi | Example of an Assembly

When you create a simple C# project and compile it, it generates an assembly in the form of a .dll (Dynamic Link Library) or .exe (Executable) file. For example, MyApp.dll can be an assembly that stores various classes and methods.

Class Libraries in Hindi  | Class Library:

A Class Library is a library that contains a collection of various types of classes and methods, which can be used repeatedly during application development. In .NET, a Class Library provides common functionality between different frameworks and applications.

Work of Class Libraries in Hindi | Function of Class Libraries:

  • A Class Library mainly provides reusable code that can be added and used in more than one application. This library is a means of classifying and organizing code, so that developers can use the library directly instead of developing the same functionality repeatedly.
  • For example, if you need common functionality such as file I/O, data processing, or web requests (HTTP Requests), you can use the System.IO or System.Net library of .NET.

Examples of Class Libraries in Hindi | Examples of Class Libraries:

Some of the main Class Libraries in the .NET Framework are as follows:

  • System Namespace: This namespace is the main part of the .NET Framework and contains a collection of basic classes such as data types, console input/output, exception management, etc. Example:

using System;

namespace Example {
    public class Demo {
        public void ShowMessage() {
            Console.WriteLine("Hello from Class Library!");
        }
    }
}
  • System.Collections Namespace: This contains a collection of Collection Classes such as List, Dictionary, ArrayList, Queue, etc., which are used for data collection and management.
  • System.IO Namespace: This is a collection of classes for input/output operations, such as reading and writing files.
  • System.Net Namespace: This is used for networking tasks, such as HTTP requests and URL management.

Advantages of Class Libraries in Hindi | Advantages of a Class Library:

  • Reusability: Once a Class Library is developed, it can be directly added and used in any application.
  • Time saving: Developing it reduces the development time of an application because some functionality is already ready.
  • Modular and organized code: By using Class Libraries, the code can be kept modular and clean.
  • Simplicity in maintenance: The code of a Class Library can be easily updated and improved, and the update is applied to all applications that are using it.

Create Class Libraries in Hindi | Creating a Class Library:

When we create a .NET Class Library project in an IDE like Visual Studio and compile it, it generates a DLL (Dynamic Link Library) file. This DLL can be added to other .NET applications. Example:

  • Create a new Class Library project and name it, such as MyLibrary.
  • Create a Class file and add classes and methods to it.
  • Compile this project, which creates a file named MyLibrary.dll.
  • This DLL can be used in other projects by adding a reference.

Relation of Assemblies & Class Libraries in Hindi | Relationship between Assemblies and Class Libraries:

  • There is a close relationship between Assemblies and Class Libraries. Class Libraries are a collection of one or more classes and their code, which can be stored in the form of a DLL.
  • A DLL is a type of assembly that provides the facility to share and reuse Class Libraries. Thus, Class Libraries are stored in the form of an assembly, and an assembly can add one or more Class Libraries.