public static int IndexOf <T>(this System.Web.UI.WebControls.ObjectDataSource dataSource, Func <T, bool> predicate) { var data = dataSource.Select() as IEnumerable <T>; for (int i = 0; i < data.Count(); i++) { if (predicate(data.ElementAt(i))) { return(i); } } return(-1); }
public static T Get <T>(this System.Web.UI.WebControls.ObjectDataSource dataSource, int index) => (dataSource.Select() as IEnumerable <T>).ElementAt(index);