當前位置: 首頁>>代碼示例>>C#>>正文


C# List.Delimited方法代碼示例

本文整理匯總了C#中iTextSharp.text.List.Delimited方法的典型用法代碼示例。如果您正苦於以下問題:C# List.Delimited方法的具體用法?C# List.Delimited怎麽用?C# List.Delimited使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.List的用法示例。


在下文中一共展示了List.Delimited方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Generate

        public static void Generate(IEnumerable<ICrew> ecrews)
        {
            ILog logger = LogManager.GetCurrentClassLogger ();

            IList<ICrew> crews = ecrews.ToList();
            int showAthlete = Int32.Parse(ConfigurationManager.AppSettings ["showcompetitor"].ToString ());
            if(crews.Any(cr => cr.StartNumber > 0))
            {
                logger.Info ("crews have start numbers. ");
                if(crews.Any(cr => cr.StartNumber <= 0))
                    logger.Warn ("but some don't, that's not right - delete the start positions or fix the JSON.");
                Dump (crews, showAthlete);
                return;
            }
            IList<string> startpositions = new List<string> ();

            int lym = Int32.Parse (ConfigurationManager.AppSettings ["LastYearMen"].ToString ());
            int lyw = Int32.Parse(ConfigurationManager.AppSettings["LastYearWomen"].ToString());
            int lywo = Int32.Parse(ConfigurationManager.AppSettings["LastYearWomenOrder"].ToString());

            foreach(var crew in
                crews
                .Where(cr => !cr.IsScratched) //  && cr.IsAccepted)
                .OrderBy(cr => cr.EventCategory.Gender == Gender.Open && cr.PreviousYear.HasValue && cr.PreviousYear.Value <= lym ? cr.PreviousYear.Value : lym+1)
                    // if the cat order is before last year's women, observe it, otherwise part it - so that last year's women aren't directly behind last year's men.
                .ThenBy(cr => cr.Categories.First(cat => cat is EventCategory).Order < lywo ? cr.Categories.First(cat => cat is EventCategory).Order : lywo)

                .ThenBy(cr => cr.EventCategory.Gender == Gender.Female && cr.PreviousYear.HasValue && cr.PreviousYear.Value <= lyw ? cr.PreviousYear.Value : lyw+1)
                .ThenBy(cr => cr.Categories.First(cat => cat is EventCategory).Order)
                .ThenBy(cr => cr.CrewId.Reverse()))
            // todo - put the vets head vs scullers head into config
            //			foreach(var crew in
            //				crews
            //					.OrderBy(cr => cr.Categories.First(cat => cat is EventCategory).Order)
            //					.ThenBy(cr => cr.PreviousYear.HasValue && cr.PreviousYear.Value <= 3 ? cr.PreviousYear.Value : 5)
            //					.ThenBy(cr => cr.CrewId.Reverse()))
            {
                logger.InfoFormat("{0} [{2}], {1}, {3}, {4}",
                    crew.Name, crew.CategoryName,
                    crew.AthleteName(showAthlete, true), crew.CrewId,
                    crew.PreviousYear.HasValue ? crew.PreviousYear : -1);
                startpositions.Add(String.Format("{{\"CrewId\":{0},\"StartNumber\":{1}}}", crew.CrewId, startpositions.Count+1));
            }
            logger.Info(startpositions.Delimited());
        }
開發者ID:unsliced,項目名稱:head-race-management,代碼行數:45,代碼來源:StartPositionGenerator.cs


注:本文中的iTextSharp.text.List.Delimited方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。