Tutorials - C#, WPF, ASP.NET MVC, WCF, Entity Framework, AngularJS and MVVM Frameworks - MVVM Light - DotNetPattern.com

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 operating system resources. When we initialize the semaphore object we initiali...

Continue Reading

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 u...

Continue Reading

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 unblocks the waiting thread....

Continue Reading

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 to update the data at the same time, the memory get corrupted and ...

Continue Reading

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. Get currently executing assembly, load assembly, get assembly from type Get classes declared in assemblies Get methods, properties, fields, events, constructors declared in classes Check access modifiers of classes, properties, fields and me...

Continue Reading

.NET Threading Interview Questions Series - Part 1

Q 1.  What is the difference between Process and Thread? A process is started when you start an Application. A process is a collection of resources like virtual address space, code, security contexts etc. A process can start multiple threads. Every process is start with a single thread called primary thread. You can create n number of threads in a process. Threads share...

Continue Reading

.NET Threading Interview Questions Series - Part 2

Q 21. What is the class hierarchy of wait handles? Q 22. What is ManualResetEvent and how it is different between AutoResetEvent? ManualResetEvent is also a synchronization mechanism similar to AutoResetEvent which works on bool variable. If the bool variable is false, it blocks the thread. If true, it unblocks the threads. ManualResetEvent provides the sa...

Continue Reading

WPF Architecture

WPF is a successor of Windows Forms. Earlier Windows Forms uses the Windows Graphics Device Interface (GDI+) for rendering any graphics, and drawing text. WPF is a new framework for developing rich Windows smart client applications that uses the DirectX technology behind the scene. WPF is resolution-independent because WPF uses vector graphics for drawing the controls on the sc...

Continue Reading

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 work?  WPF applications are based on Single Threaded Apartment Model (STA). Ob...

Continue Reading

WPF ComboBox - Tooltip for each item

Many readers ask me a question regarding how we can add a tooltip for each item of ComboBox in WPF. Here I am presenting a very simple solution. In the below example, I am creating a simple combobox. ComboBox DataTemplate defines a ListBoxItem for each item in combobox. ListBoxItem has both Content and Tooltip property.  As we cannot use String.Format in Tooltip bi...

Continue Reading

Join our newsletter and get an occasional email with a technology and DotNetPattern.com news update.