Skip to content

Commit 571ba43

Browse files
authored
Use Any extension method in EnumerableExtensionsForConventions.IsEmpty and IsNotEmpty (#446)
Updated methods to use the Any() Linq extension method. Using Count() is horrible for performance.
1 parent 52a3b41 commit 571ba43

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/FluentNHibernate/Conventions/EnumerableExtensionsForConventions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public static bool Contains<T>(this IEnumerable<T> collection, Func<T, bool> pre
3737

3838
public static bool IsEmpty<T>(this IEnumerable<T> collection)
3939
{
40-
return collection.Count() == 0;
40+
return !collection.Any();
4141
}
4242

4343
public static bool IsNotEmpty<T>(this IEnumerable<T> collection)
4444
{
45-
return !IsEmpty(collection);
45+
return collection.Any();
4646
}
4747
}
48-
}
48+
}

0 commit comments

Comments
 (0)