How to Wait for Task in C# thread programming

In this article I will discuss the various ways by which we can wait for task completion in C#. There are many ways in which we can wait for a single task or multiple tasks.

Continue reading

Using Enum to store multiple bool fields

Hello, Once I attended an interview for the C# programming job. And programmer asked me a question. Though I was not able to answer the question. But I will share here the question and the answer using enum in this post which can help you to encounter any such scenario in your job.

Continue reading

How to perform C# Asynchronous operations

In this article I will discuss about the different ways in which we can perform a long running operation asynchronously in C#. I will discuss all the cases with examples. This will help you to decide which method you can opt for while working asynchronous programming. Continue reading

Comparing C# types – IComparable or IComparer

How to make best of the interfaces provided by .NET framework for comparison types? In this article I will discuss why to use IComparable or IComparer interfaces. And why do we need to compare types in .NET at first place.Lets’s start checking all the aspects one by one by using C# examples.

Continue reading

Task output with correct parameter

Correct way to provide parameter to C# Task

In this article I will discuss the correct way to provide input parameter to the task and not to use the shared variable for the tasks. Before reading further you may want to read my previous articles about tasks.

Continue reading

Binary Search

Analysing the code using Big O notation

Are you writing software an any programming language? If yes, have you ever wondered while writing even a simple iteration or recursive method how good or bad is it? In this article I will try to analyse my algorithm which I have written to get some end results. I will use C# as the language. I will use big O notation to find the worst case complexity.

Continue reading

Important IEnumerable methods for Fast programming

In this article I will discuss some of the important functions which have been provided by the .NET framework for IEnumerable types. These functions comes very handy to work in fast paced development.Lets see what are these functions are. I will use C# as the language for the examples.

Continue reading

Implementing Equality For C# value Types

Introduction

In one of the previous article I have discussed about the equality in C#. In that article I have shown why it is important to override the Equal() method of the base object class for value types. and what is the correct way to provide the equality for the value types in C#.

Continue reading

Parameter less constructor

C# Generic Constraints

In my previous article I  have discussed about the generics in C#. Here in this article I will discuss about the various generics constraints and how they can be useful. Lets see all the generic constraints provided by C#.

Continue reading

Generics – The C# type parameters

Generic Introduction

C# is an extensible language. We can extend the functionality of a C# class by deriving from the class and overriding the virtual and abstract methods, Similarly code reuse is also one of the benefits we get out of inheritance. And generics also helps us to reuse the already existing code. Lets see how.

Continue reading

Create N number of instance of C# class

Do you know how to create ‘N’ number of instance of class in C#? In my article about the OOP and C# interview question I have asked one of the question (question number 3). Before reading this article you may want to read about the singleton pattern here.

Continue reading

Interview

OOP and C# Tricky Interview Question

Hello, In this article I will ask some of the tricky C# and OOP interview question which are asked at experienced level. These questions can be faced by all the experienced C# professionals appearing for the IT companies interviews.

Continue reading

Provider Implementation to make Extensible Software

Ever thought how we can replace the class instance without recompiling the project in C#? In this article I will discuss how we can use Provider pattern to make extensible software. In one of my article I have talked about loose coupling and dependency injectionI will use a very simple example to demonstrate how we can replace the functionality of one assembly or class without even compiling the project. This will be done dynamically at run time. I have used C# as the language for this project.

Continue reading

Deep dive into Reference and Value type Equality

In this article I will discuss the two most common ways to compare the value type and reference types in C# in .NET. You can refer here to know about the value types and reference types. System.Object contains an virtual method known as Equals. It also contains the operator overloading for the equality operator “==”.

Continue reading

How to create and Install C# Windows Service

In this article I will discuss about the windows service development and installation. The benefit of having a windows service is that we can put a timer in the service and do the operation on specified time span. Using that timer the service will keep performing its operation. I will develop the service using the C# as language.

Continue reading

Why do we use Abstract class

In one of my previous article I have described about why do we use interface in C#But in C# we have very important class known as abstract class. Abstract class can have one or more methods which can be abstract(only signature). But interface only contain the method signature. Then how is an abstract class different from an interface in C#. It is one of the favourite question in C# interview. What is abstract class and why do we use it?

You can learn more about virtual, override , new and abstract keywords here .


Continue reading

Parsing Log file using Regular Expression

In this article I will discuss about the regular expression in C#. I will use the regular expression to parse a log text file. This example I am using to have a better understanding of the regular expressions. Moreover I will state the most commonly used patterns.
Continue reading

C# Property With Class Immutability

In this article I will discuss about the C# properties and how we can create immutable class in using C# property with code example. Further I will discuss evolution of properties from C# 1.0 to C# 6.0

Continue reading

C# async await simple example

In this article I will discuss about the async await keywords. These have been introduces in the C# 5.0 and .NET 4.5 framework to make task parallel library more convenient to use with tasks. Many times while working on the long running operation we stumble upon usage of asynchronous programming. Here we want to use C#’s async and await keyword but don’t know how to use it with C#. In this article I will use the same example which I have used in my previous article about C# task result, continuation and exceptionYou can read about the basic of task here.

Continue reading