Tag 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 »

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 »

Advantages of method Overloading in C#.Net

By | November 19, 2017

Advantages of method Overloading in C#.Net Or When/Why to Use Method Overloading in C#.Net Suppose you get one program to create a method which can do sum of two numbers, three numbers & four numbers by passing parameters. So you will end up writing following methods, Public void SumTwoNumbers(int a, int b) { } Public… Read More »

Polymorphism in .Net and Types of Polymorphism in .Net

By | November 18, 2017

Polymorphism in .Net and Types of Polymorphism in .Net Polymorphism means having more than one form. It means same operation may behave differently on different classes. It is classified into compile time polymorphism or early binding or static binding and Runtime polymorphism or late binding or dynamic binding. 1) Static/early Binding /Compile Time Polymorphism: The mechanism… Read More »

What is Encapsulation

By | November 17, 2017

What is Encapsulation? Abstraction Vs Encapsulation It’s wrapping of data members and functions into a single unit called as class. An encapsulated object is often called an abstract data type. Advantage: Encapsulation can protect your data from accidental corruption Example: Let’s take example of substring() function which returns the string based on the start index and… Read More »