C#

C# Semaphore

C# semaphore allows only a limited number of threads to enter into a critical section. Semaphore is mainly used in scenarios where we have limited number of resources and we have to limit the number of threads that can use it. How Semaphore Works Semaphores are Int32 variables stored in a …

C# Semaphore Read More
C#

C# CountdownEvent

C# CountdownEvent is a synchronization primitive which unblocks a waiting thread when its receives signal a certain number of times. CountdownEvent is used in fork-join scenarios. As shown in the above diagram, master thread divides its work into 3 parallel tasks. After all parallel tasks are completed, then it joins its …

C# CountdownEvent Read More
C#

C# Barrier

C# Barrier class is synchronization primitives used in .NET threading. Barrier is used in an algorithm which composed of multiple phases.  In this Barrier synchronization, we have multiple threads working on a single algorithm. Algorithm works in phases. All threads must complete phase 1 then they can continue to phase 2. …

C# Barrier Read More

Top 10 C# / .NET Multithreading Interview Questions

Question 1. What is the difference between Threads and Tasks? Tasks are wrapper around Thread and ThreadPool classes. Below are some major differences between Threads and Tasks: Question 2. What are Interlocked functions? Interlocked functions in .NET are useful in multithreading programs to safely change the value of shared variables. By default C# variables …

Top 10 C# / .NET Multithreading Interview Questions Read More
LINQ / C#

LINQ Overview

Welcome to LINQ Tutorials. LINQ provides an uniform and powerful SQL like query language in C#/VB.NET to query different data sources. In the tutorial, we will learn all to basics and advanced LINQ language and how to use it your own projects with some live examples. We will go step by …

LINQ Overview Read More
C# / LINQ

LINQ Introduction

LINQ is an acronym for Language Integrated Query. LINQ is introduced in .NET 3.5. Before LINQ, developers need to use different languages for retrieving and saving different data sources. For example if you want to retrieve data from SQL or Oracle database you must learn some basics of SQL query language, …

LINQ Introduction Read More
LINQ / C#

LINQ Basics

Before we start learning LINQ language, we must learn some basic knowledge of most used concepts in LINQ. Sequence A sequence is any collection object that implements the IEnumerable<> interface. LINQ queries only works with the sequences. In the above example, List<string> has implement the IEnumerable interface and countries is the …

LINQ Basics Read More