示例#1
0
        //
        // Summary:
        //     Creates a System.Collections.Generic.List<T> from an System.Collections.Generic.IEnumerable<T>.
        //
        // Parameters:
        //   source:
        //     The System.Collections.Generic.IEnumerable<T> to create a System.Collections.Generic.List<T>
        //     from.
        //
        // Type parameters:
        //   TSource:
        //     The type of the elements of source.
        //
        // Returns:
        //     A System.Collections.Generic.List<T> that contains elements from the input
        //     sequence.
        //
        // Exceptions:
        //   System.ArgumentNullException:
        //     source is null.
        public static SearchFilterOneColumn[,] ToListExtended <TSource1, TSource2>(this List <TSource1> source, List <TSource2> sourceToAppend)
        where TSource1 : SearchFilterOneColumn
        where TSource2 : SearchFilterOneColumn
        {
            //IEnumerable<Feature> x = System.Linq.Enumerable.Where<TSource>(source, predicate);
            int i = 0;

            SearchFilterOneColumn[,] twocols = new SearchFilterOneColumn[System.Math.Max(source.Count, sourceToAppend.Count), 2];

            foreach (SearchFilterOneColumn f in source)
            {
                twocols[i, 0] = f;
                twocols[1, 1] = sourceToAppend[i];
                //    f.FeatureRowNumber = i;
                i++;
            }
            return(twocols);
            //"(List<TSource>)source";


            //int index = source.Select((item, i) => new { Item = item, Index = i })
            //    .First(x => x.Item == search).Index;

            //// or
            //var tagged = list.Select((item, i) => new { Item = item, Index = i });
            //int index = (from pair in tagged
            //             where pair.Item == search
            //             select pair.Index).First();
        }
        public bool GetFirstColumn(Feature f, SearchFilterOneColumn row)
        {
            return(false);
            //int counter = 0;
            ////This will yield when counter is 0 or 1, and not when it's 2, 3, or 4.
            ////The result is yield two, skip 3, repeat.
            //foreach (Browser line in GetBrowsers())
            //{
            //    if (counter == 1)
            //        yield return line;

            //    //add one to the counter and have it wrap,
            //    //so it is always between 0 and 4 (inclusive).
            //    counter = (counter + 1) % 2;
            //}
        }