Category Archives: C#

Ternary operator in C#

By | June 13, 2018

Ternary Operator:  ” ?: ” Ternary operator means simple if else condition in one statement based on condition. we can say this is dicision making operator. Syntax: var output = Boolean expression ? first value : second value It three parts, First part (before ?) includes conditional expression that returns boolean value true or false. Second part (after ? and before ‘:’… Read More »

Lazy Loading C#.Net

By | March 26, 2018

Some of the interviewer’s favourate question or we can say common interview question is What is Lazy Loading in C#.Net and when to use it  Lazy Loading in C#.Net Lazy loading is the concept in which we delay the loading of the object until the point where we need it. In simple terms loading the objects on… Read More »

When to use abstract class and when to use interface

By | January 1, 2018

When to use abstract class and when to use interface This question can be asked in many different ways, situation/scenario when to choose one over another. Abstract Class can be used in situation: When you want to declare feilds and assign default value to it, go for abstract class over interface. For E.g.: When i… Read More »

Inheritance in C# With Example

By | December 17, 2017

Inheritance in C# With Example? Let’s start with the concept Inheritance in C# with example, Inheritance is the concept in which one type (class/interface) derives data member and member functions from another type is called as inheritance. The type which derives the members from another type is called as derived type and the type from… Read More »

Advantage of abstract class over Interface in C#.Net

By | December 12, 2017

Advantage of abstract class over Interface in C#.Net Adding new functions/methods to existing interface is difficult as compared to adding it to abstract class. If you want to add a new functions/methods to existing interface, you must have to implement the new functions in all of the classes that implement the changed interface. The code… Read More »

Abstract Class Vs Interface in C#.Net

By | December 10, 2017

Abstract Class Vs Interface in C#.Net Abstract Class Vs Interface in C#.Net Memebers Allowed Abstract as well as non abstact allowed. Only abstract members are Allowed. Implementation of methods in derived classes Not necessary to implement all the methods of base (abstract) class for derived classes. The derived class must implement all the methods of… Read More »

What is Interface in C#.net ?

By | December 10, 2017

What is Interface in C#.net Interface is a type which contains only the signatures/declaration of methods/functions, delegates or events. Declaration /signature of methods meaning method having no implementation as follows, void Display(string name); //By Default interface member is Public It does not contain implementation of methods. Implementation of the methods is done by the class… Read More »

Abstract Class in C#

By | December 9, 2017

Abstract Class in C# a) Classes can be declared as abstract class by using abstract keyword. b) Abstract class is designed to act as a base class (to be inherited by other classes).Abstract class is a design concept in program development and provides a base upon which other classes are built. c) Abstract class does not allow… Read More »