コード例 #1
0
        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);
        }
コード例 #2
0
 public static T Get <T>(this System.Web.UI.WebControls.ObjectDataSource dataSource, int index)
 => (dataSource.Select() as IEnumerable <T>).ElementAt(index);