//The MIT License (MIT)
//http://arolibraries.codeplex.com/license
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
namespace AroLibraries.ExtensionMethods.Enumerable
{
public static class IEnumerableExt
{
/// Returns the index of the first occurrence in a sequence by using aspecified IEqualityComparer.
/// ///
/// The type of the elements of source.
/// A sequence in which to locate a value. ///
/// The object to locate in the sequence /// An equality comparer to compare values.
/// The zero-based index of the first occurrence of value within the entire sequence, if found; otherwise, –1.
public static int Ext_IndexOf(this IEnumerable list, TSource value, IEqualityComparer comparer)
{
int index = 0;
foreach (var item in list)
{
if (comparer.Equals(item, value))
{
return index;
}
index++;
}
return -1;
}
}
}