algorithms c# C# gives NullReferenceException while processing lists Jun 4, 2011 See the question and my original answer on StackOverflow You probably have a null Value, so ToString() fails.