Posts

Inheritance Concept

Image
Descriptions : To inherit fields and methods from one class to another.  It includes two class. Derived Class - the class that inherits from another class Base Class - the class being inherited from Types: 1. Single Inheritance 2. Multilevel Inheritance 3. Hierarchical Inheritance 4. Multiple Inheritance ( using  Interface) Example : Single Inheritance In the below example there are the two classes declared. One class is ClassA and another one is ClassB. Here ClassB is inherted the classA. ClassB is considered as derived class and ClassA is considered as base class. Class is inherited by special character ":" colon. Below in the main function, there is the object of the ClassB is created and it is also used the member of the classA. Output:

Assembly Manifest

Image
Description : Contains a collection of data that describes how the elements in the assembly relate to each other.  The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes.  The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information. Types of assemblies:  1. Single File Assembly 2. Multi File Assembly Assembly Manifest Contents Metadata: ·           Metadata is the complete way of de scribing what is in a .NET assembly. ·          Digging into the metadata yields the types available in that assembly, viz. classes, interfaces, ...

Value Type Variable

Image
Description : Value type variables can be assigned a value directly.  They are derived from the class System.ValueType . The value types directly contain data.  which stores numbers, alphabets, and floating point numbers, respectively.  When you declare an  int  type, the system allocates memory to store the value. Example: Some examples are  int, char, and float etc.

C# Nullable Type

Image
Description: C# provides a special data types, the  nullable type which is used to assign the null value in the variable. Suppose there is variable and there will be situation where user want to assign null value to same variable. So here system will give the exception.   To remove this drawback, c# introduces the nullable type.   Syntax : < data_type> ? <variable_name> = null; Example :

"this" Keyword

Image
Description : "this" keyword is used to represent the current instance of class. "this" keyword is used to refer current instance members. Lets we see the simple example Example : Here there is simple class "Student". "Student" class has the variable "studentName" member and method "getStudentName()." Value of member "studentName" is assigned by constructor by the "this" keyword. When object of the "Student" class , constructor is called and value is assigned in the class member "studentName" with "this" keyword. Output :

C# Extention Method

Image
Description : Extention method allows user to add the new function in the existing type without creating new derived class, recompiling or modifying the existing class. Extention methods are static methods. Example: In the below example in the screen shot, method "getWelcomeMessage()" is the extention method of string type.

Comments in C#

Image
Please find below points Play a very important role in maintenance of program. Increased the readability and understanding of the code. Two type of comments              1. Single Line Comment (//)              2. Multiline Comment (/* */) Example : 1. Single Line Comment (//) It is used the special characters "//" and comment only the single line. In the below example only one line is commented. 2. Multi line Comment (/**/) It is used the special characters "/*.....*/" and comment only the multiple line. In the below example only one line is commented.