Better exception message.
authorMarek Safar <marek.safar@gmail.com>
Thu, 28 Jan 2010 19:22:58 +0000 (19:22 -0000)
committerMarek Safar <marek.safar@gmail.com>
Thu, 28 Jan 2010 19:22:58 +0000 (19:22 -0000)
svn path=/trunk/mcs/; revision=150391

mcs/class/System.Core/System.Linq/Enumerable.cs

index c6d72fe40fc1f3b99a39c85487dd2d18afb2b6d3..2b44f9f420e9bb3d304930668b2a5c63772d7a37 100644 (file)
@@ -603,8 +603,6 @@ namespace System.Linq
                        if (list != null) {
                                if (list.Count != 0)
                                        return list [0];
-
-                               throw new InvalidOperationException ();
                        } else {
                                using (var enumerator = source.GetEnumerator ()) {
                                        if (enumerator.MoveNext ())
@@ -612,7 +610,7 @@ namespace System.Linq
                                }
                        }
 
-                       throw new InvalidOperationException ();
+                       throw new InvalidOperationException ("The source sequence is empty");
                }
 
                public static TSource First<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)