Category Archives: C#

Understand Inheritance and Polymorphism with example

In this post, we will understand the Inheritance and Polymorphism concept of OOP’S practically. In most of the interviews, interviewers asked these inheritance questions and trying to confuse you but after reading this post you will easily understand and clear all confusion. When you derive a class from a base class, the derived class will inherit all… Read More »

AutoMapper in C#

AutoMapper is an object-object mapper which allows you to solve the problem of manually mapping each property of a class with the same properties of another class. AutoMapper saves you the tedious effort of having to manually map one or more properties of such incompatible types. Before AutoMapper was introduced if we wanted to assign… Read More »

Explicitly implementation of Interface

In this post, We will learn how to implement multiple interfaces with same method name with example. When a class which has inherited an interface explicitly implements methods of that class is called explicit implementation.This method can now be accessed only through interface instance.They are useful in cases when a class inherits two interfaces and both… Read More »

Constructor in C#

Constructor is special method of a class that name is same as class name. Main use of constructors is to initialize private fields of the class while creating an instance for the class. Constructor is automatically invoked or called when an instance of that class is created. When you have not created a constructor in the class, the… Read More »

OOPS Concept

OOP is a paradigm that used for software development that have following principle. Object: An object is a real world entity that have physical existence in world. Class: a blue print of an object that describe the character and behavior of object. Abstraction: hiding the complexity and show the necessary data to the user. Encapsulations: wrapping up… Read More »

Enumeration in C#

An enumeration is a set of named integer constants and declared by enum keyword. They are value data type in other words it has their own value or can not inherit. Enumeration list is seperated by comma and by default first enumeration list is 0(or starts with zero). syntax: enum <enum_name> { enumeration_list }; Example:… Read More »

How to validate XML with XSD file in using c#

Here we will learn how to validate XML  with XSD file in using c# with example. //In below example, we are passing three parameters: //xmlString: XML String //XSDPath: Path of XSD file //NamespaceXML: Namespace of xml public static bool IsValidXml(string xmlString, string XSDPath, string NamespaceXML) { bool isValidXML = true; List<string> errrorMssage = null;… Read More »

XML Serialization and Deserialization in C#

Here we will learn how to implement XML serialization and deserialization in using c# with example: First, we will do serialization of an object as below example //Pass an object of a class public static string SerializeObject(T Request) { string xmlString = string.Empty; MemoryStream memoryStream = null; XmlSerializer xs = null; XmlTextWriter xmlTextWriter =… Read More »