Category Archives: C#

Singleton design Pattern in C# with examples

By | April 3, 2021

Singleton desing Pattern in C# with example It is creational design pattern, as it deals with object creation and manipulation. Here we are going to learn, What is singleton desing pattern When to use singleton design patterns / Why to use singleton design patterns Real-time examples of Singleton design patterns Advantages of singleton design patterns… Read More »

Splitting a list or collection into chunks in C#

By | December 12, 2020

Problem Statement –  While working on project, one requirement came like client wants to save 50k of records into db in one go. which was taking lot of time to save long list of data to be proceessed and saved in database. also we had 8 api nodes and this code were running on signle… Read More »

How to clear nuget cache to get updated files on local

By | July 1, 2020

Clearing the nuget cache Many times we face wired problem like nuget packages are not getting updated locally, even after we take latest code and build or rebuild [or even clean and build] the solution properly. Then also latest nuget packages are not getting downloaded on local folder and we get some errors. Solution 1:… Read More »

Intersection of two string arrays in c#

By | November 27, 2019

lets say we have two arrays and we want to find common element which are present in both the arrays, then use intersect method. It is an extension method present in system.linq namespace. string[] days1 = {“Mon”,”Tue”, “thr”, “Fri”, “Sun” }; string[] days2 = {“Mon”,”Wed”, “Fri”, “Sat”, “Sun”}; Here we want to find common days… Read More »

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 »