当前位置: 首页>>代码示例>>C#>>正文


C# List.Where方法代码示例

本文整理汇总了C#中Novacode.List.Where方法的典型用法代码示例。如果您正苦于以下问题:C# List.Where方法的具体用法?C# List.Where怎么用?C# List.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Novacode.List的用法示例。


在下文中一共展示了List.Where方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectValidpHint

        public virtual List<PrintingHint> SelectValidpHint(List<PrintingHint> pHint, double smallerCalculatedDCutLessZero, double smallerCalculatedDCut)
        {
            List<PrintingHint> pHint1;

            pHint1 = pHint.Where(x => x.IsDie || (x.DCut2 >= this.MinDCut
                    && x.DCut2 <= this.MaxDCut && (x.DCut1 >= x.DCut2 || (x.DCut1 == 0 && x.MaxGain1 == 1)))).ToList();

            var c = pHint1.Where(y => !y.IsDie);

            if (c.Count() == 0 || MinDCut == 0)
            {
                //fascette gommate
                if (MinDCut == 0 && MaxDCut == 0)
                {
                    var pHint2 = pHint.Where(x => x.IsDie || (x.DCut2 == smallerCalculatedDCutLessZero * -1));
                    pHint1 = pHint.Where(x => x.IsDie || (x.DCut2 >= 0 && x.DCut2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 || x.DCut1 == 0))).ToList();
                    var pHint3 = pHint1.Union(pHint2);
                    pHint1 = pHint3.ToList();
                }
                else
                {
                    var smaller = pHint.Where(x => x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1).Select(x => x.DeltaDCut2).Min();
                    var pHintLast1 = pHint.Where(x => x.IsDie || (x.DeltaDCut2 == smaller && (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1)));

                    try
                    {
                        var smaller2 = pHint.Where(x => (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1) && x.DeltaDCut2 != smaller).Select(x => x.DeltaDCut2).Min();
                        var pHintLast2 = pHint.Where(x => x.IsDie || (x.DeltaDCut2 == smaller2 && x.DeltaDCut2 != smaller && (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1)));


                        pHint1 = pHintLast1.Union(pHintLast2).ToList();

                    }
                    catch (Exception)
                    {
                        pHint1 = pHintLast1.ToList();

                    }
                    //                    pHint1 = pHint.Where(x => x.DCut2 >= 0 && x.DCut2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 || x.DCut1 == 0)).ToList();
                }
            }

            var pRemove = pHint1.Select(x => x.BuyingFormat.GetSide1() == 0);
            Console.WriteLine(pRemove);

            pHint1 = pHint1.Where(x => x.GainOnSide2 > 0 && x.GainOnSide1 > 0).ToList();

            return pHint1.Where(x => x.BuyingFormat.GetSide1() != 0).ToList();
        }
开发者ID:algola,项目名称:backup,代码行数:49,代码来源:ProductPartEx.cs

示例2: SelectValidpHint

        public override List<PrintingHint> SelectValidpHint(List<PrintingHint> pHint, double smallerCalculatedDCutLessZero, double smallerCalculatedDCut)
        {
            List<PrintingHint> pHint1;

            pHint1 = pHint.Where(x => x.DCut2 / 2 >= this.MinDCut
                    && x.DCut2 / 2 <= this.MaxDCut && (x.DCut1 >= x.DCut2 / 2 || (x.DCut1 == 0 && x.MaxGain1 == 1))).ToList();

            if (pHint1.Count <= 1)
            {
                //fascette gommate
                if (MinDCut == 0 && MaxDCut == 0)
                {
                    var pHint2 = pHint.Where(x => x.DCut2 / 2 == smallerCalculatedDCutLessZero * -1);
                    pHint1 = pHint.Where(x => x.DCut2 / 2 >= 0 && x.DCut2 / 2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0)).ToList();
                    var pHint3 = pHint1.Union(pHint2);
                    pHint1 = pHint3.ToList();
                }
                else
                {
                    var smaller = pHint.Where(x => (x.DCut1 >= x.DCut2 / 2) || x.DCut1 == 0).Select(x => x.DeltaDCut2).Min();
                    var pHintLast1 = pHint.Where(x => x.DeltaDCut2 == smaller && (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0));

                    try
                    {
                        var smaller2 = pHint.Where(x => (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0) && x.DeltaDCut2 != smaller).Select(x => x.DeltaDCut2).Min();
                        var pHintLast2 = pHint.Where(x => x.DeltaDCut2 == smaller2 && x.DeltaDCut2 != smaller && (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0));

                        pHint1 = pHintLast1.Union(pHintLast2).ToList();

                    }
                    catch (Exception)
                    {
                        pHint1 = pHintLast1.ToList();

                    }
                    //                    pHint1 = pHint.Where(x => x.DCut2/2 >= 0 && x.DCut2/2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2/2 || x.DCut1 == 0)).ToList();
                }
            }

            return pHint1;

        }
开发者ID:algola,项目名称:backup,代码行数:42,代码来源:ProductPartDoubleLabelRollEx.cs

示例3: InsertAtBookmark

        public virtual void InsertAtBookmark(string toInsert, string bookmarkName)
        {
            if (bookmarkName.IsNullOrWhiteSpace())
                throw new ArgumentException("bookmark cannot be null or empty", "bookmarkName");

            var headerCollection = Document.Headers;
            var headers = new List<Header> { headerCollection.first, headerCollection.even, headerCollection.odd };
            foreach (var header in headers.Where(x => x != null))
                foreach (var paragraph in header.Paragraphs)
                    paragraph.InsertAtBookmark(toInsert, bookmarkName);

            foreach (var paragraph in Paragraphs)
                paragraph.InsertAtBookmark(toInsert, bookmarkName);

            var footerCollection = Document.Footers;
            var footers = new List<Footer> { footerCollection.first, footerCollection.even, footerCollection.odd };
            foreach (var footer in footers.Where(x => x != null))
                foreach (var paragraph in footer.Paragraphs)
                    paragraph.InsertAtBookmark(toInsert, bookmarkName);
        }
开发者ID:ScottSnodgrass,项目名称:DocX,代码行数:20,代码来源:Container.cs

示例4: dropdown_for_courses

        public ActionResult dropdown_for_courses(int? symposium_id)
        {
            if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated == true)
            {
                if (symposium_id == null)
                {
                    var symposiums = db.Symposiums.ToList();
                    int i = 0;
                    int count = 0;
                    foreach (var item in symposiums)
                    {

                        count = count + item.Courses.Count();
                    }
                    Course[] found_courses = new Course[db.Courses.Count()];
                    found_courses[0] = db.Courses.First();
                    int ix = 0;
                    var all_courses = db.Courses.ToList();
                    List<Course> list = new List<Course>();
                    foreach (var item in all_courses)
                    {
                        if (list.Where(x => x.courseNumber == item.courseNumber).FirstOrDefault() == null)
                        {
                            list.Add(item);
                            ix++;
                        }
                    }

                       ViewBag.CourseNames = db.Courses.Select(x=> x.courseName).ToArray();

                        ViewBag.CourseNumbers = db.Courses.Select(x => x.courseName);

                    ViewBag.Courses = list;
                    ViewBag.Course_Count = db.Courses.ToList().Count();
                }
                else
                {
                    Symposium found_symposium = db.Symposiums.Find(symposium_id);
                    Project[] projects = found_symposium.Projects.Distinct().ToArray();
                    int array_length = projects.Count();
                    int[] course_ids = new int[array_length];
                    for (int i = 0; i < projects.Count(); i++)
                    {
                        course_ids[i] = projects[i].courseID;
                    }

                    Course[] found_courses = new Course[projects.Count()];

                    for (int i = 0; i < projects.Count(); i++)
                    {

                        found_courses[i] = db.Courses.Find(projects[i].courseID);
                    }
                    found_courses = found_courses.Distinct().ToArray();

                    ViewBag.Course_Count = found_courses.Count();
                    ViewBag.Courses = found_courses;
                }
                return View();
            }
            else
            {
                return RedirectToAction("desktop_vote", "Projects");
            }
        }
开发者ID:jweinzimmer,项目名称:SymposiumVoting,代码行数:65,代码来源:ProjectsController.cs

示例5: TemplBuilder

 private TemplBuilder(bool useDefaultModules)
 {
     //Add default handlers for Sections,tables,pictures,text,TOC,comments. Ordering is important.
     DefaultModules = new List<TemplModule>()
     {
         new TemplSectionModule("Section", this, new string[] { "sec" }),
         new TemplPictureReplaceModule("Picture Replace", this, new string[] { "pic" }),
         new TemplRepeatingTextModule("Repeating Text", this, new string[] { "li" }),
         new TemplRepeatingCellModule("Repeating Cell", this, new string[] { "cel" }),
         new TemplRepeatingRowModule("Repeating Row", this, new string[] { "row" }),
         new TemplPictureReplaceModule("Picture Replace", this, new string[] { "pic" }),
         new TemplTableModule("Table", this, new string[] { "tab" }),
         new TemplPicturePlaceholderModule("Picture Placeholder", this, new string[] { "pic" }),
         new TemplTextModule("Text", this, new string[] { "txt" }),
         new TemplTOCModule("Table of Contents", this, new string[] { "toc" }),
         new TemplCommentsModule("Comments", this, new string[] { "!" }),
     };
     Modules.AddRange(DefaultModules.Where(mod => useDefaultModules));
 }
开发者ID:ichpuchtli,项目名称:templ-dot-net,代码行数:19,代码来源:Builder.cs


注:本文中的Novacode.List.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。