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


C# IList.RemoveAt方法代码示例

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


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

示例1: Filter

		public override void Filter(IList<ContentItem> items)
		{
			while (items.Count > maxCount + startIndex)
				items.RemoveAt(items.Count - 1);
			while (items.Count > maxCount)
				items.RemoveAt(0);
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:7,代码来源:CountFilter.cs

示例2: ModifyListForTest

 private void ModifyListForTest(IList<string> list)
 {
     list[0] = "OneModified";
     list.Insert(0, "Zero");
     list.RemoveAt(0);
     list.Insert(0, "ZeroAgain");
     list.Insert(4, "Four");
     list.RemoveAt(4);
     list.Insert(4, "FourAgain");
 }
开发者ID:cupsster,项目名称:TrackableData,代码行数:10,代码来源:StorageListValueTestKit.cs

示例3: BindQuestion

        protected void BindQuestion()
        {
            queslist = CY.CSTS.Core.Business.Question.GetSqlWhere("[IsHomePage]=1");
            unsolvequestion = new List<CY.CSTS.Core.Business.Question>();

            for (int i = 0; i <= queslist.Count - 1; i++)
            {
                if (!isanswer(queslist.ElementAt(i).Id))
                {
                    unsolvequestion.Add(queslist.ElementAt(i));

                }

            }

            for (int i = queslist.Count - 1; i >= 0; i--)
            {
                if (!isanswer(queslist.ElementAt(i).Id))
                {
                    queslist.RemoveAt(i);
                }

            }
            if (queslist.Count >= 4)
            {
                for (int i = queslist.Count - 1; i >= 4; i--)
                {
                    queslist.RemoveAt(i);
                }
            }
            for (int i = 0, j = queslist.Count; i < j; i++)
            {
                //queslist[i].Title = CY.Utility.Common.StringUtility.CutString(queslist[i].Title, 80, "...");
            }

            //Questionlist.DataSource = queslist;
            //Questionlist.DataBind();

            if (unsolvequestion.Count >= 4)
            {
                for (int i = unsolvequestion.Count - 1; i >= 4; i--)
                {
                    unsolvequestion.RemoveAt(i);
                }
            }
            for (int i = 0, j = unsolvequestion.Count; i < j; i++)
            {
                //unsolvequestion[i].Title = CY.Utility.Common.StringUtility.CutString(unsolvequestion[i].Title, 80, "...");
            }
        }
开发者ID:dalinhuang,项目名称:cy-csts,代码行数:50,代码来源:TabExpertForNew.ascx.cs

示例4: Schedule

        /// <summary>
        /// Fill bigger time into scheduleList first, until there is no time smaller than [morning/afternoon]TimeLeft
        /// </summary>
        /// <param name="requests"></param>
        /// <returns></returns>
        public override IEnumerable<DaySchedule> Schedule(IList<ScheduleItem> requests)
        {
            if (requests.Count == 0) return null;

            List<DaySchedule> scheduleList = new List<DaySchedule>();

            while (requests.Count > 0)
            {
                DaySchedule daySchedule = new DaySchedule();
                // Schedule morning meeting
                int moringTimeLeft=ConfigurationSetting.MorningDuration;
                for (int i = requests.Count-1; i >=0; i--)
                {
                    if (requests[i].ScheduleTime == moringTimeLeft)
                    {
                        daySchedule.MorningPlan.Add(requests[i]);
                        requests.RemoveAt(i);
                        break;
                    }
                    else if (requests[i].ScheduleTime < moringTimeLeft)
                    {
                        daySchedule.MorningPlan.Add(requests[i]);
                        moringTimeLeft -= requests[i].ScheduleTime;
                        requests.RemoveAt(i);
                    }
                }

                // Schedule afternoon meeting
                int afternoonTimeLeft = ConfigurationSetting.AfternoonDuration;
                for (int i = requests.Count - 1; i >= 0; i--)
                {
                    if (requests[i].ScheduleTime == afternoonTimeLeft)
                    {
                        daySchedule.AfternoonPlan.Add(requests[i]);
                        requests.RemoveAt(i);
                        break;
                    }
                    else if (requests[i].ScheduleTime < afternoonTimeLeft)
                    {
                        daySchedule.AfternoonPlan.Add(requests[i]);
                        afternoonTimeLeft -= requests[i].ScheduleTime;
                        requests.RemoveAt(i);
                    }
                }

                scheduleList.Add(daySchedule);
            }

            return scheduleList;
        }
开发者ID:Yuanxiangz,项目名称:WorkSpace,代码行数:55,代码来源:EfficiencyFirstStrategy.cs

示例5: Perform

 /// <summary>
 /// Deletes the employee
 /// </summary>
 public override void Perform(IList<Employee> employees, IEnumerable<Employee> query, StringBuilder log)
 {
     var employee = employees[Index];
     employees.RemoveAt(Index);
     log.AppendFormat("Delete Employee {0}", employee.Name);
     log.AppendLine();
 }
开发者ID:NMFCode,项目名称:QueryBenchmark,代码行数:10,代码来源:DeleteEmployeeAction.cs

示例6: RotateRight

 public static void RotateRight(IList sequence, int count)
 {
     //This method makes a swap of the list elements to the right
     object tmp = sequence[count - 1];
     sequence.RemoveAt(count - 1);
     sequence.Insert(0, tmp);
 }
开发者ID:RuParusheva,项目名称:TelerikAcademy,代码行数:7,代码来源:Permutations.cs

示例7: Draw

        public override void Draw(
			IList<Point> points,
			double thickness,
			int miterLimit,
			ILogicalToScreenMapper logicalToScreenMapper)
        {
            // First define the geometric shape
            var streamGeometry = new StreamGeometry();
            using (var gc = streamGeometry.Open())
            {
                gc.BeginFigure(points[0], _fillAndClose, _fillAndClose);
                points.RemoveAt(0);

                gc.PolyLineTo(points, true, true);
            }

            using (var dc = RenderOpen())
                dc.DrawGeometry(
                    _fillAndClose ? Brushes.White : null,
                    new Pen(
                        Brushes.White,
                        thickness == 1 ? 0.25 : thickness)
                        {
                            MiterLimit = miterLimit
                        },
                    streamGeometry);
        }
开发者ID:Bruhankovi4,项目名称:Emotyper,代码行数:27,代码来源:LineDrawingVisual.cs

示例8: FixExpressions

        public IList<string> FixExpressions(IList<string> expressions)
        {
            expressions = RemoveEmptyExpressions(expressions);

            var listHasChanged = true;
            while (listHasChanged)
            {
                listHasChanged = false;
                for (var i = 0; i < expressions.Count; i++)
                {
                    var exp = expressions[i];
                    if (!this.expressionValidator.IsNumberAndOperator(exp)) continue;
                    var splitted = RemoveEmptyExpressions(SplitByOperator(exp));
                    expressions.RemoveAt(i);

                    foreach (var newExp in splitted)
                    {
                        expressions.Add(newExp.Trim());
                        i++;
                    }
                    listHasChanged = true;
                }
            }
            return expressions;
        }
开发者ID:eltoby,项目名称:CalculadoraTDD,代码行数:25,代码来源:ExpressionFixer.cs

示例9: Process

        override protected void Process(IFCAnyHandle ifcPolyLoop)
        {
            base.Process(ifcPolyLoop);

            List<IFCAnyHandle> ifcPolygon = 
                IFCAnyHandleUtil.GetAggregateInstanceAttribute<List<IFCAnyHandle>>(ifcPolyLoop, "Polygon");
            
            if (ifcPolygon == null)
                return; // TODO: WARN

            Polygon = IFCPoint.ProcessScaledLengthIFCCartesianPoints(ifcPolygon);

            int numVertices = Polygon.Count;
            if (numVertices > 1)
            {
                if (Polygon[0].IsAlmostEqualTo(Polygon[numVertices - 1]))
                {
                    // LOG: Warning: #: First and last points are almost identical, removing extra point.
                    Polygon.RemoveAt(numVertices - 1);
                    numVertices--;
                }
            }

            if (numVertices < 3)
                throw new InvalidOperationException("#" + ifcPolyLoop.StepId + ": Polygon attribute has only " + numVertices + " vertices, 3 expected.");
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:26,代码来源:IFCPolyLoop.cs

示例10: CheckFirstAndLastPoint

 private void CheckFirstAndLastPoint(IList<Point> points)
 {
     if (this.DistanceIsTooSmall(points.Last(), points.First()))
     {
         points.RemoveAt(points.Count - 1);
     }
 }
开发者ID:an83,项目名称:KinectTouch2,代码行数:7,代码来源:LineThinner.cs

示例11: SetExtension

 ///////////////////////////////////////////////////////////////////////
 /// <summary>Replaces or adds an extension of the given type
 /// to the list.
 ///
 /// This method looks for the first element on the list of the
 /// given type and replaces it with the new value. If there are
 /// no element of this type yet, a new element is added at the
 /// end of the list.
 /// </summary>
 /// <param name="extensionElements">list of IExtensionElement</param>
 /// <param name="type">type of the element to be added, removed
 /// or replaced</param>
 /// <param name="newValue">new value for this element, null to
 /// remove it</param>
 ///////////////////////////////////////////////////////////////////////
 public static void SetExtension(IList<IExtensionElementFactory> extensionElements,
                                 Type type,
                                 IExtensionElementFactory newValue)
 {
     int count = extensionElements.Count;
     for (int i = 0; i < count; i++)
     {
         object element = extensionElements[i];
         if (type.IsInstanceOfType(element))
         {
             if (newValue == null)
             {
                 extensionElements.RemoveAt(i);
             }
             else
             {
                 extensionElements[i] = newValue;
             }
             return;
         }
     }
     if (newValue != null)
     {
         extensionElements.Add(newValue);
     }
 }
开发者ID:yodiz,项目名称:Avega.ContactSynchronizer,代码行数:41,代码来源:gbaseutilities.cs

示例12: Search

 private void Search(Dictionary<int, int> count, IList<int> temp, IList<IList<int>> results)
 {
     if (!count.Any() && temp.Any())
     {
         results.Add(new List<int>(temp));
         return;
     }
     var keys = count.Keys.ToList();
     foreach (var key in keys)
     {
         temp.Add(key);
         --count[key];
         if (count[key] == 0) count.Remove(key);
         Search(count, temp, results);
         temp.RemoveAt(temp.Count - 1);
         if (count.ContainsKey(key))
         {
             ++count[key];
         }
         else
         {
             count[key] = 1;
         }
     }
 }
开发者ID:alexguo88,项目名称:LeetCode,代码行数:25,代码来源:47.PermutationsII.cs

示例13: AssignFragmentPeak

		public void AssignFragmentPeak(IList<IAtomContainer> fragments, IEnumerable<Peak> peakList, double mzabs, double mzppm)
		{
			hits = new List<PeakMolPair>();
			hitsAll = new List<PeakMolPair>();			

			foreach (var peak in peakList)
			{
				var haveFoundAMatch = false;
				foreach (var fragment in fragments)
				{
					//matched peak
					int hydrogensAdded;
					double matchedMass;
					double hydrogenPenalty;
					if (MatchByMass(fragment, peak.Mass, mzabs, mzppm, out matchedMass, out hydrogenPenalty, out hydrogensAdded))
					{
                        var match = new PeakMolPair(fragment, peak, matchedMass, GetMolecularFormulaAsString(fragment), hydrogenPenalty, double.Parse((string)fragment.getProperty("BondEnergy"), CultureInfo.InvariantCulture), GetNeutralChange(fragment, hydrogensAdded));
						hitsAll.Add(match);

						// If we don't yet have a match, add it
						if (!haveFoundAMatch)
						{
							hits.Add(match);
							haveFoundAMatch = true;
						}
						// If we do have a match, replace it if this new match has a lower hydrogen penalty
						else if (hydrogenPenalty < hits.Last().HydrogenPenalty)
						{
							hits.RemoveAt(hits.Count - 1);
							hits.Add(match);
						}						
					}
				}
			}
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:35,代码来源:FragmentPeakAssigner.cs

示例14: CheckFirstAndLastPoint

 private void CheckFirstAndLastPoint(IList<DepthPointEx> points)
 {
     if (PointsAreClose(points.Last(), points.First()))
     {
         points.RemoveAt(points.Count - 1);
     }
 }
开发者ID:guozanhua,项目名称:Kinect-Finger-Tracking,代码行数:7,代码来源:PointFilter.cs

示例15: BatchSave

        public int BatchSave(IList<MsgRecord> msgRecords)
        {
            #region prevent duplicate data
            IList<string> msgids=new List<string>();

            for(int i=0;i<msgRecords.Count;i++)
            {
                msgids.Add(msgRecords[i].MsgID);
            }

            var query = from aa in msgRecordRepository.Table
                        join bb in msgids on aa.MsgID equals bb
                        select aa.MsgID;
            IList<string> tempids = query.ToList();
            #endregion

            for (int i = msgRecords.Count-1; i >= 0; i--)
            {
                if(tempids.Contains(msgRecords[i].MsgID))
                {
                    msgRecords.RemoveAt(i);
                }
            }

            return msgRecordRepository.BatchInsert(msgRecords);
        }
开发者ID:xuailhd,项目名称:ImmediatelyChat_UDP,代码行数:26,代码来源:MsgRecordService.cs


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