コード例 #1
0
        public List <Employee> GetDetail()
        {
            List <Employee> list;
            LinqMethods     methods = new LinqMethods();

            if (dropdown2.SelectedItem.ToString() == "Basic Filter")
            {
                list = methods.BasicFilter(empList);
                return(list);
            }
            else if (dropdown2.SelectedItem.ToString() == "Order by")
            {
                list = methods.OrderBy(empList);
                return(list);
            }
            else if (dropdown2.SelectedItem.ToString() == "Join")
            {
                list = methods.Join(empList);
                return(list);
            }
            else if (dropdown2.SelectedItem.ToString() == "Group by")
            {
                list = methods.GroupBy(empList);
                return(list);
            }
            else if (dropdown2.SelectedItem.ToString() == "Quantifiers")
            {
                bool result;
                result = methods.LQuantifiersAny(empList);
                lblAnyResult.Content = result;
                result = methods.LQuantifiersAll(empList);
                lblAllResult1.Content = result;
                result = methods.LQuantifiersContain(empList);
                lblContainResult.Content = result;
            }
            else if (dropdown2.SelectedItem.ToString() == "Aggregate Functions")
            {
                double result;
                result = methods.AggregateAvg(empList);
                lblAvgResult.Content = result;
                result = methods.AggregateMin(empList);
                lblMinResult.Content = result;
                result = methods.AggregateMax(empList);
                lblMaxResult.Content = result;
                result = methods.AggregateCount(empList);
                lblCountResult.Content = result;
                result = methods.AggregateSum(empList);
                lblSumResult.Content = result;
            }
            else if (dropdown2.SelectedItem.ToString() == "Element Operators")
            {
                string result;
                result = methods.ElementAt(empList);
                lblElementAtResult.Content = result;
                result = methods.First(empList);
                lblFirstResult.Content = result;
                result = methods.Last(empList);
                lblLastResult.Content = result;
            }
            else if (dropdown2.SelectedItem.ToString() == "Set Operators")
            {
                //list = methods.Distinct(empList);
                //return list;

                //list = methods.Except(empList);
                //return list;

                //list = methods.Intersect(empList);
                //return list;

                list = methods.Union(empList);
                return(list);
            }
            return(null);
        }