Playing around with List<T>, part one - Constructors

List<T> is one of the most commonly used types from .NET Framework Base Class Library. Although it is used so often not everyone is really familiar with how the class works internally. Almost everyone knows that List<T> uses T[] array internally to store the items. But for most people that’s the only internal detail they know. In next few blog post I’ll try to step through List<T> source code and point some interesting implementation details that every .NET developer should be aware of.

Read More

Why (or when) you should/shouldn’t use Descendants() method

A lot of LINQ to XML questions on StackOverflow are being answered using Descendants() method calls. It looks like most of people think it’s the best way to handle and query XML document: it’s easy to use, you don’t have to worry about whole tree structure. It just works. But are these solutions really good ones? Is Descendants() method really that good as it seems to be? I would say: NO! I think common LINQ to XML queries should not use Descendants(). I’ll try to answer it shouldn’t be used in this blog post.

Read More