Assuming I have the following string array:
string[] str = new string[] {\"max\", \"min\", \"avg\", \"max\", \"avg\", \"min\"}
Is it possbile t
While you could use a combination of Select
and Where
, this is likely a good candidate for making your own function:
public static IEnumerable Indexes(IEnumerable source, T itemToFind)
{
if (source == null)
throw new ArgumentNullException("source");
int i = 0;
foreach (T item in source)
{
if (object.Equals(itemToFind, item))
{
yield return i;
}
i++;
}
}