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


C# List.Add方法代码示例

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


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

示例1: CreateCompanyList2

 public static List<ChartData> CreateCompanyList2()
 {
     List<ChartData> company2 = new List<ChartData>();
     company2.Add(new ChartData() { Mounth = "January", Money = 80 });
     company2.Add(new ChartData() { Mounth = "February", Money = 160 });
     company2.Add(new ChartData() { Mounth = "March", Money = 130 });
     return company2;
 }
开发者ID:kozanid,项目名称:DocX,代码行数:8,代码来源:Program.cs

示例2: CreateCompanyList1

 public static List<ChartData> CreateCompanyList1()
 {
     List<ChartData> company1 = new List<ChartData>();
     company1.Add(new ChartData() { Mounth = "January", Money = 100 });
     company1.Add(new ChartData() { Mounth = "February", Money = 120 });
     company1.Add(new ChartData() { Mounth = "March", Money = 140 });
     return company1;
 }
开发者ID:super-rain,项目名称:DocX,代码行数:8,代码来源:Program.cs

示例3: Terminos_y_resultado_Load

        private void Terminos_y_resultado_Load(object sender, EventArgs e)
        {
            float result = 0;
            int contador = 0;

            List<int> fin = new List<int>();
            for (int i = 0; i < cats.Count; i++)
            {

                if (i > 0)
                {
                    if (cats.ElementAt(i).Contains("--"))
                    {
                        contador++;
                    }
                    else
                    {
                        fin.Add(contador);
                        contador = 0;
                    }
                    if (i == cats.Count - 1)
                        fin.Add(contador);

                }
            }

            result = 0;
            int pos = 0;
            int parainsertar = 0;
            for (int i = 0; i < fin.Count; i++)
            {
                for (int j = 0; j < fin.ElementAt(i); j++)
                {
                    result += results.ElementAt(pos + j);
                }
                results.Insert(parainsertar, result);
                result = 0;
                if (pos == 0)
                    pos += fin.ElementAt(i) + 1;
                else
                    pos += fin.ElementAt(i);
                parainsertar += fin.ElementAt(i) + 1;

            }

            Resultadofinal.Text = indice.ToString();
            Idesempeño.Text = calif.ToString();
            richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, 16);
            for (int i = 0; i < cats.Count; i++)
                richTextBox1.Text += cats.ElementAt(i) + ": " + results.ElementAt(i).ToString() + "\n";
        }
开发者ID:Raimmaster,项目名称:SED,代码行数:51,代码来源:Terminos+y+resultado.cs

示例4: GetRelatedImplantCostDetail

        public virtual List<CostDetail> GetRelatedImplantCostDetail(string codProductPartTask, IQueryable<Cost> costs)
        {
            List<CostDetail> lst = new List<CostDetail>();

            var x = CreatorImplantCostDetail();

            x.ComputedBy = this;
            x.ProductPart = this.ProductPart;

            //devo pescare il costo e associarlo al dettaglio
            if (x.CodCost == null)
            {
                var xxxx = costs.ToList();

                var cost = costs.Where(pp => pp.CodProductPartImplantTask == codProductPartTask).FirstOrDefault();
                //da non usare MAIIII                    x.TaskCost = cost;
                x.CodCost = cost.CodCost;
                x.CodCostDetail = cost.CodCost;

                x.CostDetailCostCodeRigen();
            }

            //GUID
            x.Guid = this.Guid;
            this.Computes.Add(x);
            lst.Add(x);

            return lst;
        }
开发者ID:algola,项目名称:backup,代码行数:29,代码来源:CostDetail.cs

示例5: Index

        public ActionResult Index()
        {
            string category = "Computers";
            var useperiods = db.UsePeriods
                .Where(up => up.EndDate == null || up.EndDate >= DateTime.Now)
                .Where(up => up.Asset is Computer)
                .OrderBy(up => up.AssetId)
                .Select(up => new { AssetId = up.AssetId, Name = up.UserAccount.Name,
                    Function = up.Function, SerialNumber = up.Asset.SerialNumber })
                .ToList()
                ;

            List<AssetSelectListItem> list2 = new List<AssetSelectListItem>();
            foreach (var item in useperiods)
            {
                AssetSelectListItem asli = new AssetSelectListItem();
                asli.CompoundId = category.Substring(0, 1) + item.AssetId.ToString();
                asli.Identifier = asli.CompoundId + " - ";
                if (string.IsNullOrEmpty(item.Name))
                {
                    if (string.IsNullOrEmpty(item.Function))
                    {
                        asli.Identifier += item.SerialNumber;
                    }
                    else { asli.Identifier += item.Function; }
                }
                else { asli.Identifier += item.Name; }
                list2.Add(asli);
            }

            ViewBag.CompoundId = new SelectList(list2, "CompoundId", "Identifier");
            return View(new RepairInfo());
        }
开发者ID:Hazy24,项目名称:AssetManagerMvc,代码行数:33,代码来源:RepairInfoController.cs

示例6: Csapatok

 public Csapatok( string versenyAzonosito ) {
     csapatok = new List<Csapat>( );
     foreach( var versenyeredmenyek in Model.Data.Data.Eredmenyek._versenyEredmenyek.Where( eredmeny => eredmeny.VersenyAzonosito.Equals( versenyAzonosito ) ) ) {
         foreach( var csapatazonosito in versenyeredmenyek.Eredmenyek._eredmenyek.OrderBy( eredmeny => eredmeny.Csapat ).GroupBy( eredmeny => eredmeny.Csapat ).Select( grouping => grouping.Key ) ) {
             csapatok.Add( new Csapat {
                 Azonosito = csapatazonosito,
                 InduloAdatok = new InduloAdatok( versenyAzonosito, csapatazonosito )
             } );
         }
     }
 }
开发者ID:belinyak,项目名称:Ijasz2,代码行数:11,代码来源:CsapatLista.cs

示例7: GetPDInfo

        /// <summary>
        /// 从中XML读取物理图信息
        /// </summary>
        /// <returns> List</returns>
        public List<PhysicalDiagramInfo> GetPDInfo()
        {
            try
            {
                List<PhysicalDiagramInfo> PDList = new List<PhysicalDiagramInfo>();
                DocX doc = InitDocX();
                if (mTables == null)
                {
                    mTables = GetTableInfo();
                }
                PhysicalDiagramInfo pdInfo = new PhysicalDiagramInfo();
                string pid = System.Guid.NewGuid().ToString();
                pdInfo.Id = pid;
                pdInfo.Name = "所有数据";
                PDList.Add(pdInfo);

                PhysicalDiagramInfo pd = new PhysicalDiagramInfo();
                string pid1 = System.Guid.NewGuid().ToString();
                pd.Id = pid1;
                pd.Name = "数据表";
                pd.PhyParentId = pid;
                PDList.Add(pd);

                foreach (TableInfo t in mTables)
                {
                    pd = new PhysicalDiagramInfo();
                    pd.Id = System.Guid.NewGuid().ToString();
                    pd.Name = t.Code;
                    pd.IfEnd = true;
                    pd.PhyParentId = pid1;
                    PDList.Add(pd);

                }
                return PDList;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:xpengfee,项目名称:DataDic,代码行数:44,代码来源:WordReaderNew.cs

示例8: Flatten

        public static void Flatten(this XElement e, XName name, List<XElement> flat)
        {
            // Add this element (without its children) to the flat list.
            XElement clone = CloneElement(e);
            clone.Elements().Remove();

            // Filter elements using XName.
            if (clone.Name == name)
                flat.Add(clone);

            // Process the children.
            if (e.HasElements)
                foreach (XElement elem in e.Elements(name)) // Filter elements using XName
                    elem.Flatten(name, flat);
        }
开发者ID:Johnnyfly,项目名称:source20131023,代码行数:15,代码来源:_Extensions.cs

示例9: parseFile

        private static void parseFile(DocX file)
        {
            string initiator = file.CustomProperties.Where(x => x.Value.Name == "ФИО инициатора").First().Value.Value.ToString();
              string phone = file.CustomProperties.Where(x => x.Value.Name == "Телефон инициатора").First().Value.Value.ToString();
              string date = file.CustomProperties.Where(x => x.Value.Name == "Текущая дата").First().Value.Value.ToString();
              string bankroll = file.CustomProperties.Where(x => x.Value.Name == "Средства").First().Value.Value.ToString();
              string department = file.CustomProperties.Where(x => x.Value.Name == "Р*Подразделение...*Наименование").First().Value.Value.ToString();
              string content = file.CustomProperties.Where(x => x.Value.Name == "Аннотация").First().Value.Value.ToString();
              string financing = file.CustomProperties.Where(x => x.Value.Name == "Финансирование").First().Value.Value.ToString();

            List<item> items = new List<item>();
              var equipmentTable = file.Tables[0];
            for (int i = 1; i < equipmentTable.Rows.Count; i++)
            {
              items.Add(manageNotesHandler.createDirItem(equipmentTable.Rows[i].Cells[0].Paragraphs.First().Text, Convert.ToInt32(equipmentTable.Rows[i].Cells[1].Paragraphs.First().Text), equipmentTable.Rows[i].Cells[2].Paragraphs.First().Text));
            }
            manageNotesHandler.addDirNote(content, department, initiator, phone, date, bankroll, financing, items);
        }
开发者ID:NatalyRaspberryJam,项目名称:raspberryRepository,代码行数:18,代码来源:parseDocxHandler.cs

示例10: RenderSectionText

        protected override void RenderSectionText(string text)
        {
            StringBuilder builder = new StringBuilder();

            string[] lines = text.Split('\n');

            foreach (string line in lines)
            {
                if (line.StartsWith("-"))
                {
                    break;
                }
                else
                {
                    builder.AppendLine(line);
                }
            }

            List<ProsAndCons> prosAndConsList = new List<ProsAndCons>();

            for (int i = 0; i < lines.Length; i++)
            {
                string line = lines[i];

                if (line.StartsWith("- "))
                {
                    ProsAndCons prosAndCons = new ProsAndCons();

                    prosAndCons.Title = line.TrimStart("- ".ToCharArray());

                    prosAndCons.Pros = FindPros(i, lines).ToList();

                    prosAndCons.Cons = FindCons(i, lines).ToList();

                    prosAndConsList.Add(prosAndCons);
                }
            }

            RenderParagraph(builder.ToString(), _formatting.SectionText);

            RenderProsAndCons(prosAndConsList);
        }
开发者ID:boro2g,项目名称:Idea8Ball,代码行数:42,代码来源:NextStepsDocumentSectionRenderer.cs

示例11: GetInitalizedPartTask

        public override List<ProductPartTask> GetInitalizedPartTask()
        {
            var tsksInPart = new List<ProductPartTask>();

            ProductPartTask pt;

            String[] codTypeOfTasks = { "STAMPAMORBIDO" };

            foreach (var item in codTypeOfTasks)
            {
                pt = new ProductPartTask();
                //default selection
                pt.OptionTypeOfTask = SystemTaskList.FirstOrDefault(x => x.CodTypeOfTask == item).OptionTypeOfTasks.FirstOrDefault(y => y.CodOptionTypeOfTask == item + "_NO");
                pt.CodOptionTypeOfTask = pt.OptionTypeOfTask.CodOptionTypeOfTask;
                pt.Hidden = true;
                tsksInPart.Add(pt);
            }

            return tsksInPart;
        }
开发者ID:algola,项目名称:backup,代码行数:20,代码来源:ProductSoftEx.cs

示例12: ValidateBookmarks

        public string[] ValidateBookmarks(params string[] bookmarkNames)
        {
            var headers = new[] {Document.Headers.first, Document.Headers.even, Document.Headers.odd}.Where(h => h != null).ToList();
            var footers = new[] {Document.Footers.first, Document.Footers.even, Document.Footers.odd}.Where(f => f != null).ToList();

            var nonMatching = new List<string>();
            foreach (var bookmarkName in bookmarkNames)
            {
                if (headers.SelectMany(h => h.Paragraphs).Any(p => p.ValidateBookmark(bookmarkName))) return new string[0];
                if (footers.SelectMany(h => h.Paragraphs).Any(p => p.ValidateBookmark(bookmarkName))) return new string[0];
                if (Paragraphs.Any(p => p.ValidateBookmark(bookmarkName))) return new string[0];
                nonMatching.Add(bookmarkName);
            }

            return nonMatching.ToArray();
        }
开发者ID:ScottSnodgrass,项目名称:DocX,代码行数:16,代码来源:Container.cs

示例13: 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

示例14: SetWidthsPercentage

 /// <summary> 
 /// Set Table column width by prescribing percent 
 /// </summary> 
 /// <param name="widthsPercentage">column width % list</param> 
 /// <param name="totalWidth">Total table width. Will be calculated if null sent.</param>
 public void SetWidthsPercentage(float[] widthsPercentage, float? totalWidth)
 {
     if (totalWidth == null) totalWidth = this.Document.PageWidth - this.Document.MarginLeft - this.Document.MarginRight; // calculate total table width
     List<float> widths = new List<float>(widthsPercentage.Length); // empty list, will hold actual width
     widthsPercentage.ToList().ForEach(pWidth => { widths.Add((pWidth * totalWidth.Value / 100) * (96 / 72)); }); // convert percentage to actual width for all values in array
     SetWidths(widths.ToArray()); // set actual column width
 }
开发者ID:WordDocX,项目名称:DocX,代码行数:12,代码来源:Table.cs

示例15: InsertRow

        /// <summary>
        /// Insert a row into this table.
        /// </summary>
        /// <example>
        /// <code>
        /// // Load a document.
        /// using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
        /// {
        ///     // Get the first table in this document.
        ///     Table table = document.Tables[0];
        ///        
        ///     // Insert a new row at index 1 in this table.
        ///     Row row = table.InsertRow(1);
        ///
        ///     // Loop through each cell in this new row.
        ///     foreach (Cell c in row.Cells)
        ///     {
        ///         // Set the text of each new cell to "Hello".
        ///         c.Paragraphs[0].InsertText("Hello", false);
        ///     }
        ///
        ///     // Save the document to a new file.
        ///     document.SaveAs(@"C:\Example\Test2.docx");
        /// }// Release this document from memory.
        /// </code>
        /// </example>
        /// <param name="index">Index to insert row at.</param>
        /// <returns>A new Row</returns>
        public Row InsertRow(int index)
        {
            if (index < 0 || index > RowCount)
                throw new IndexOutOfRangeException();

            List<XElement> content = new List<XElement>();
            for (int i = 0; i < ColumnCount; i++)
            {
                var w = 2310d;
                if (ColumnWidthsValue != null && ColumnWidthsValue.Length > i)
                    w = ColumnWidthsValue[i] * 15;
                XElement cell = HelperFunctions.CreateTableCell(w);
                content.Add(cell);
            }

            return InsertRow(content, index);
        }
开发者ID:WordDocX,项目名称:DocX,代码行数:45,代码来源:Table.cs


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