-
Notifications
You must be signed in to change notification settings - Fork 0
/
all.cs
45 lines (35 loc) · 977 Bytes
/
all.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
#if WITH_NAME_SPACE
namespace CScripting
{
#endif
public partial class CScripting
{
#region all
/// <summary>
/// <see cref="Enumerable"/>
/// </summary>
/// <typeparam name="TSource"></typeparam>
/// <param name="iterable"></param>
/// <param name="predicate"></param>
/// <returns></returns>
public static bool All<TSource>(IEnumerable<TSource> iterable, Func<TSource, bool> predicate = null)
=> All(iterable, predicate);
#if OBSOLETE
[Obsolete("This method is deprecated, use `{nameof(All)}` instead.")]
#endif
public static bool all<TSource>(IEnumerable<TSource> iterable, Func<TSource, bool> predicate = null)
{
if (predicate == null)
return iterable.All(a => Convert.ToBoolean(a));
else
return iterable.All(predicate);
}
#endregion
}
#if WITH_NAME_SPACE
}
#endif