@@ -14,11 +14,16 @@ public static bool IsNullOrEmpty<T>(this IEnumerable<T> data)
14
14
return data == null || ! data . Any ( ) ;
15
15
}
16
16
17
+ public static bool ContainsIgnoreCase ( this IEnumerable < string > values , string value )
18
+ {
19
+ return values . Contains ( value , StringComparer . OrdinalIgnoreCase ) ;
20
+ }
21
+
17
22
public static IEnumerable < IList < T > > Paginate < T > ( this IEnumerable < T > items , int pageSize )
18
23
{
19
24
var page = new List < T > ( ) ;
20
25
21
- foreach ( var item in items ?? Enumerable . Empty < T > ( ) )
26
+ foreach ( var item in items ?? [ ] )
22
27
{
23
28
page . Add ( item ) ;
24
29
if ( page . Count >= pageSize )
@@ -42,7 +47,7 @@ public static IEnumerable<IList<T>> Paginate<T>(this IEnumerable<T> items, int p
42
47
/// <remarks>If an exception occurs, the action will not be performed on the remaining items.</remarks>
43
48
public static void Apply < T > ( this IEnumerable < T > items , Action < T > action )
44
49
{
45
- foreach ( var item in items ?? Enumerable . Empty < T > ( ) )
50
+ foreach ( var item in items ?? [ ] )
46
51
{
47
52
action ( item ) ;
48
53
}
@@ -56,7 +61,7 @@ public static void Apply<T>(this IEnumerable<T> items, Action<T> action)
56
61
/// <remarks>If an exception occurs, the action will not be performed on the remaining items.</remarks>
57
62
public static void Apply < T > ( this List < T > items , Action < T > action )
58
63
{
59
- foreach ( var item in items ?? Enumerable . Empty < T > ( ) )
64
+ foreach ( var item in items ?? [ ] )
60
65
{
61
66
action ( item ) ;
62
67
}
0 commit comments