Working with Assemblies in C# – Bestdotnettraining

Working with Assemblies in C# – Bestdotnettraining Introduction:

    This article explains the Libraries in .NET, Types of DLL, and Assemblies in .NET and its structure, Namespaces and Internal Access Specifier.

Description:
I. Introduction to Libraries
Dynamic Linking Library: A DLL is an application which can have everything that an EXE can have. The difference between them is, an EXE can execute independently but DLL cannot. The code in the DLL can be reused in many other applications but the code in EXE cannot be reused.

II. Types of DLL in Windows OS:
1. Win32 DLL: Here the code is available in the form of simple “C” functions.
2. COM DLL: This DLL has code in the form of reusable COM Components. These are also referred to as ActiveX DLL
3. .NET DLL: These DLL’s (Portable Executables) are used for distributing the reusable classes to various types of .NET applications.

Note:

• The Portable Executable (PE) format is a file format for executables, object code, DLLs, FON Font files and others used in 32-bit and 64-bit versions of Windows operating systems
• PE is a modified version of the Unix COFF file format. PE/COFF is an alternative term in Windows development.
• Microsoft’s .NET Framework has extended the PE format with features which support the Common Language Runtime (CLR).
• The CLR section of it contains two important segments: Metadata and Intermediate Language (IL) code

III. What is Assembly in .NET
An assembly is a collection of types (classes, interface, struct etc…) and resources (bmp, jpg, string table, txt, ico) that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.

Assemblies are a fundamental part of programming with the .NET Framework.
• It contains code that the common language runtime executes.
• It forms a security boundary.
• It forms a type of boundary.
• It forms a reference scope boundary.
• It forms a version boundary.
• It forms a deployment unit.
• It is the unit at which side-by-side execution is supported.

Note: We should create a multifile assembly when you want to combine modules written in different languages and to optimize downloading an application by putting seldom-used types in a module that is downloaded only when needed
Note The files that make up a multifile assembly are not physically linked by the file system. Rather, they are linked through the assembly manifest and the common language runtime manages them as a unit.

Assembly Manifest Content:
1. Assembly Name
2. Version Number
3. Culture
4. Strong name information
5. List of all files in an assembly
6. Type reference information of types exported from the assembly
7. Information about other referenced assemblies

IV. About Namespaces
• A namespace is a logical collection of classes and other types with unique names. In a given namespace all the types have a unique name and thus it is used to resolve the ambiguity in case of a name conflict.
• Any type when used outside the namespace, it must be qualified by its namespace, but when used by another type within the same namespace it need not be qualified by the namespace.
• We can use using Namespace on top of the file so that we don’t have to qualify all the types of that namespace in that file explicitly.

V. Internal Access Specifier
• A public Class is accessible within and outside the assembly. Whereas an internal class can be accessed only by other types within the same assembly (irrespective of the namespace of other classes within the assembly).
• Internal is the default access specifier for the class.
• The top-level class can only be declared as either public or internal but nested class (a class within class) can have any access modifier.
• The namespace can never be used as a boundary for an access specifier. It’s used only as a name qualifier.
• An internal member of a class is accessible to all other types within the same assembly and is not accessible outside the assembly.
• A member declared as “protected internal” is accessible to all the class within the assembly and only to the derived classes outside the assembly.
• A public method of a public class cannot have either as a parameter or return type any data type of the same assembly which is not public (or is internal).

VI. Types of Assemblies:
1. Private Assemblies: An assembly whose local copy is maintained by each & every application referencing to it.
2. Shared Assembly: An assembly whose single copy deployed in Global Assembly Cache (GAC) and used/shared by many applications running on that machine. Such assemblies must have a Strong name.
3. Satellite Assembly: A resource-only assembly for a given culture is called as a satellite assembly. They don’t have any code but they have only resources like string tables and images.
4. Dynamic Assemblies: These run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed. The API method Reflection. Emit is used to create dynamic assemblies

 

Working with Assemblies in C#
Working with Assemblies in C#

 

Please follow and like us:
0

Working With Static In C sharp

Article by Mr Sandeep Soni on ”
Description

Working With Static In C sharp: The static keyword can be applied on data members, constructors, classes, methods, properties, and events. The static modifier makes an item non-instantiable.

 

 

C# program using static class
C# program using static class

 

: https://www.c-sharpcorner.com/article/working-with-static-in-c-sharp/
Please feel free to like and post comments on the article. Also Like the profile of “Sandeep Soni” to get future updates.

You can search the profile –
1. Search
2. under “People” tab
3. Type First Name “Sandeep”, Last Name “Soni”
4. click on the profile – Hit Like.

Introduction

This article is all about static in C#. It explains about,
Static members
Static constructor
Static methods and properties
Static class
Example using all these.
Description

The static keyword can be applied to data members, constructors, classes, methods, properties, and events. The static modifier makes an item non-instantiable.

Static members in C#

When are they loaded and how is the memory allocation,
A class is loaded when either

The static members of the class are accessed for the first time, or
When the first instance of the class is created.
A class once loaded will remain in memory permanently and also are all static members of that class.

For every new instance of a class, all the instance members are allocated memory as one unit, but static field members of a class are allocated memory only once, irrespective of the number of objects created, and they are allocated memory when the class is loaded. These members are also called class members and are accessed outside the class using the class name.

A public static member of a class can be used as a Global member of the application because it can be assessed using a class name from any part of the application.

Static Constructor in C#

It is a constructor with the static keyword.
It is used to initialize static members dynamically and is executed when the class is loaded.
It is invoked by the CLR when the class is loaded by it and hence cannot be overloaded nor can be declared with any accesses specifier like public or private.
Series of events that occur when the first object is created,

The class is loaded.
Static members are loaded and allocated memory.
The static constructor is executed.
An object is created and Instance members are loaded and allocated memory.
Instance constructor is executed.
4 and 5 repeats for a subsequent object.

Please follow and like us:
0

Best C Sharp Video Inheritance Concepts in C Sharp.Best Dot Net Training

Best C Sharp Video Inheritance Concepts in C Sharp.Best Dot Net Training

Description: Best C Sharp Video Inheritance Concepts in C Sharp.Best Dot Net Training

 Watch Free C# videos, Subscribe to our channel and Click on the bell icon for more updates.

https://bit.ly/2ydTaPo

Best C Sharp Video Inheritance Concepts in C Sharp.Best Dot Net Training

For Best Courses Online Visit Our Website

https://www.bestdotnettraining.com/

This Video Inheritance Concepts in C#

Is recorded by Mr Sandeep Soni, MCT

In this video we have covered the following topics:
========================================

Agenda

1. Introduction to Inheritance
2. Constructors & Inheritance
3. Typecasting of Reference Types
4. Static and dynamic binding
5. Abstract classes

Overview

Inheritance depends upon “is a” relationship.
For example:
 The car is a Vehicle
 A faculty is a Person
 A student is a Person
 The chair is a Furniture

Static and Dynamic Binding

Virtual methods are dynamically bound i.e., the actual method called would be decided at runtime and the decision
is based on the object to which the reference variable invoking the method is referring to.

Abstract Classes and Methods

1. An abstract method is a method in which a declaration is provided
but an implementation is not.
2. A class with one or more methods declared as abstract must be
declared as abstract and such a class cannot
be instantiated because its behaviour is incomplete.

System.Object Class

Every class in .NET is inherited from System. Object class. Thus the functionality in Object class is available to all the
objects in .NET. Also the reference variable of type System. An object can refer to instance/object of any class in .NET
Methods in Object class:
1. bool Equals(object obj) // Compares the current object reference
with obj and returns true if both are
referring to the same object otherwise returns false.
2. System.Type GetType() //returns the Type instance for the
current objects class.

For more details regarding https://www.bestdotnettraining.com/csharp-online-training

Visit Our Complete Video Tutorials channel
https://www.youtube.com/user/Deccansoft123

This Video Tutorial is thought by Mr Sandeep Soni Microsoft Certified Trainer having 20 Years of IT Industrial Experience guided 100+ Corporate experts, about 50000 + students got prepared under his initiative.

In this instructional exercise, ideas are taught with ongoing Examples in simple and justifiable strategies for absolute beginners to cutting-edge levels.

Visit for More Video Tutorials provided by Microsoft Certified Trainer in MS.NET Technologies

Follow us :
Facebook: https://www.facebook.com/bestdotnetTraining
Google+: https://plus.google.com/u/0/106673331317048429651

Please follow and like us:
0

About Microsoft.Net Framework – Best Dot Net Training.

About Microsoft.Net Framework - Best Dot Net Training.
About Microsoft.Net Framework – Best Dot Net Training.

Category of Programmers

  • System Programmers – One who programs directly for a given hardware eg: Device Drivers or extremely low-level o/p services.
  • Application Programmers – One who programs applications used by people for their requirements – eg: Calculator, Calendar, MS-Office like packages, Accounting Packages etc…
  • .NET is for Application programming and not for System programming. Continue reading “About Microsoft.Net Framework – Best Dot Net Training.”
Please follow and like us:
0