Possible Duplicate:
Why does .NET foreach loop throw NullRefException when collection is null?
foreach iterator throws the exception if the target collection is null.
Example:
List<string> names = null;
foreach(var name in names) { /* throws exception */ }
What is the design idea behind it. Isn't it handy to not iterate through the loop instead .NET Framework throwing exception?