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

C# Reflection - What is Assembly?

Assembly is the main unit in .NET applications. Assembly is a collection of types and its information. There are two types of assemblies: Executable files (EXE) Libraries (DLL) Both type of assemblies includes information about types and its members in its metadata. There are three ways to get Assembly instances: Geting assembly instance from type...

Continue Reading

C# Reflection - Getting Constructors

C# reflection Type class provides two methods for getting the constructors in any Type. GetConstructors() //Returns all the constructors GetConstructor() //Returns only the specific constructor with match your given criteria. By default, all the above methods returns public constructors of a Type. To get the private, protected, and static constructors you have to u...

Continue Reading

C# Reflection - MemberInfo Class

MemberInfo class provides a quick look of all the members in a Type. Below is the same code to get all members of a Type. static void Main(string[] args) { Type type = typeof(Program); foreach(MemberInfo member in type.GetMembers()) { Console.WriteLine(member.Name + ":" + member.MemberType); } } MemberInfo MemberType property MemberInfo prov...

Continue Reading

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 provides us the Assembly in which the type is dec...

Continue Reading

C# Action

A delegate in C# represents a reference type that encapsulates a method. When we declare a delegate type we specify some parameters and a return type. We can only store those methods in delegates which has same parameters and same return type. Microsoft introduced some pre-built delegates so that we don't have to declare delegates every time. Action is one of the pre-b...

Continue Reading

5 minutes Guide of WPF ListView ItemTemplate

ListView control in WPF is used for display a list of items. Every list view item has its own UI for display its own data. But how every listview item is rendered, it's depend on the ItemTemplate property of ListView. ItemTemplate property is used for get and set the DataTemplate of every list view item. DataTemplate defines how each item appears. You defines a single...

Continue Reading

BlockingCollection in C# - Introduction and Examples

BlockingCollection is a collection class which ensures thread-safety. Multiple threads can add and remove objects in BlockingCollection concurrently. It implements the producer-consumer pattern. In this pattern, there are two threads one is called producer and other is called consumer. Both threads share a common collection class to exchange data between them. BlockingC...

Continue Reading

ConcurrentBag in C# - Introduction and Examples

ConcurrentBag is one of the thread-safe collection classes introduced in .NET 4.0. ConcurrentBag allows you to store objects in unordered way. Contrary to ConcurrentDictionary class, it allows you to store duplicate objects. ConcurrentBag allows multiple threads to store the objects. It is optimized for scenarios where same thread act as producer and consumer. That means sam...

Continue Reading

ConcurrentDictionary in C# - Introduction, Examples

ConcurrentDictionary is one of five collection classes introduced in .NET 4.0. It exists in System.Collections.Concurrent namespace. ConcurrentDictionary is thread-safe collection class to store key/value pairs. ConcurrentDictionary can be used with multiple threads concurrently.  Without ConcurrentDictionary class, if we have to use Dictionary class with mult...

Continue Reading

ConcurrentQueue in C# - Introduction and Examples

C# ConcurrentQueue is a thread-safe collection class. It is introduced in .NET 4.0 with other concurrent collection classes. It provides a thread-safe First-In-First-Out (FIFO) data structure. You can read more about Queue here. ConcurrentQueue exists in System.Collections.Concurrent namespace ConcurrentQueue is a wrapper around generic Queue class. Queue...

Continue Reading

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