Something similar to linq find in which position is my object in List, except his accepted answer is evaluating at an object level.
Say I have
public interface IFoo{
string text {get;set;}
int number {get;set;}
}
and
public class Foo : IFoo{
public string text {get;set;}
public int number {get;set;}
}
Now I have a list collection of IFoo
like so:
public IList<IFoo> Foos;
I want to write a method that brings back the index(es) of Foos
based upon a property value and/ or values (for example, text
or number
in this case) so I can do something like:
var fooIndexes = Foos.GetIndexes( f => f.text == "foo" && f.number == 8 );
How would I write that?