C# / WPF

WPF BackgroundWorker

To build more responsive WPF UI, we have to use multiple threads that can work in the background and update the UI when the work completed. But background threads can’t access the objects created in the STA. Then how can we update the UI when the background threads completed their …

WPF BackgroundWorker Read More
C#

C# Reflection Introduction

Reflection in C# is a big topic in itself. I’ll summarize a little list of what you can do with reflection. .NET assembly is a collection of types and its metadata. Metadata describes all the types and its structures like methods, fields, events, and properties. Metadata also defines all the attributes defined …

C# Reflection Introduction Read More
C#

C# Reflection – Type class

A Type class is an important class in C# reflection. Type class represents class types, interface types, array types, value types, enum types, type parameters, generic type definitions, and open/closed generic types. Type class helps you to find properties, methods, events, fields, and constructors declared in a type. It also …

C# Reflection – Type class Read More
C#

Synchronization Tutorials

One of the benefits of using multithreading in .NET is to improve the performance of our applications. We execute long running tasks in the background threads and make the UI thread idle to get the user’s inputs. We share resources between multiple threads such as memory. If multiple threads will try …

Synchronization Tutorials Read More
C#

AutoResetEvent

AutoResetEvent is one of the easy synchronization primitives in .NET threading synchronization. AutoResetEvent is used for send signals between two threads. Both threads share the same AutoResetEvent object. Thread can enter into a wait state by calling WaitOne() method of AutoResetEvent object. When second thread calls the Set() method it …

AutoResetEvent Read More
C#

ManualResetEvent

ManualResetEvent like AutoResetEvent is another synchronization techniques in .NET threading.  ManualResetEvent is used for send signals between two or more threads. Multiple threads can enter into a waiting/blocking state by calling the WaitOne method on ManualResetEvent object. When controlling thread calls the Set method all the waiting threads are unblocked and free …

ManualResetEvent Read More
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