Easier manipulation with IEnumerable objects

Useful extension methods for working with lists, arrays, dictionaries...
Working with any collection which implements IEnumerable is pretty easy in C#, plus if you are using LINQ you can easily manipulate with collection data. Recently I was doing some filtering with some in-memory collections and I had to check whether one collection contains same elements as some other collection with elements of the same type ... read more

Managed Extensibility Framework (MEF) quick start

Introducing MEF with simple code example application
Managed Extensibility Framework or MEF is a library introduced in .NET Framework 4 which allows developers to easily create plugin based applications. It lives in System.ComponentModel.Composition namespace and before start working with MEF reference to this assembly needs to be added in a project.It is basically an implementation of IoC (Inversion of Control) pattern with few core functionalities such as assembly loading ... read more

Random element of IEnumerable/Array

Random element extension method for IEnumerable/Array
I don't work with random values very often but recently I had to write some small function that returns random value from an array. It sounded like a good idea to write it as an extension method to make it reusable for other projects ... read more

ConcurrentDictionary vs Hashtable.Synchronized

Comparison of collections in multithread environment
Basically all Dictionary collections in .NET internally implement Hashtable wrapped, so in terms of mechanism they are pretty much the same. The difference is that Dictionary exposes strong types while Hashtable uses object-object keyvalue pair which is much harder to work with because you need to know what is the actual type of the object stored in a key or value. Often casting will probably be required ... read more


read more


read more