System.Collections.Generic.IEnumerable.Contains(TSource)

Here are the examples of the csharp api System.Collections.Generic.IEnumerable.Contains(TSource) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

8 Examples 7

19 Source : CollectionExtensions.cs
with MIT License
from ay2015

[Pure]
    public static bool AllExistIn<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> set)
    {
        Contract.Requires(source != null);
        Contract.Requires(set != null);

        return source.All(item => set.Contains(item));
    }

19 Source : CollectionExtensions.cs
with Mozilla Public License 2.0
from daixin10310

[Pure]
        public static bool AllExistIn<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> set)
        {
            Contract.Requires(source != null);
            Contract.Requires(set != null);

            return source.All(item => set.Contains(item));
        }

19 Source : CollectionExtensions.cs
with MIT License
from funwaywang

public static bool CollectionEqual<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
        {
            if (first == null && second == null)
                return true;
            if (first == null || second == null)
                return false;

            if (first.Count() != second.Count())
                return false;

            foreach (var item in first)
            {
                if (!second.Contains(item))
                    return false;
            }

            return true;
        }

19 Source : ExtendedLinq.cs
with GNU General Public License v3.0
from grandnode

public static bool ContainsAll<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> values)
        {
            return values.All(v => source.Contains(v));
        }

19 Source : ExtendedLinq.cs
with GNU General Public License v3.0
from grandnode

public static bool ContainsAny<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> values)
        {
            return source.Any(s => values.Contains(s));
        }

19 Source : EnumerableExtensions.cs
with MIT License
from JohannesMoersch

public static async Task<bool> Contains<TSource>(this Task<IEnumerable<TSource>> source, TSource value)
			=> (await source).Contains(value);

19 Source : OrderedEnumerableExtensions.cs
with MIT License
from JohannesMoersch

public static async Task<bool> Contains<TSource>(this Task<IOrderedEnumerable<TSource>> source, TSource value)
			=> (await source).Contains(value);

19 Source : ObjectExtensions.cs
with Apache License 2.0
from unoplatform

public static bool IsOneOf<TSource>(this TSource source, params TSource[] acceptedValues)
        {
            return acceptedValues?.Contains(source) ?? false;
        }