Pop quiz – given:
Stack<int> stack;
what is the difference between:
return stack.Count;
and:
return stack.Count();
Is it:
Answer: all of the above.
The extension methods defined in the System.Linq namespace are tremendously powerful, and can be a thing of beauty when used wisely, but with great power comes great responsibility. I find it a more than a little scary that such a subtle code change can have such dramatic performance implications!