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


C# IList.GetEnumerator方法代码示例

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


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

示例1: report

        public static void report(StringWriter output, IList<Machine> machines, Robot robot)
        {
            output.Write("<h1>FACTORY REPORT</h1>\n");

            IEnumerator<Machine> line = machines.GetEnumerator();
            while (line.MoveNext())
            {
                Machine machine = line.Current;
                output.Write("<h2>" + machine.Name() + "</h2>\n");
                output.Write("<ul>\n");
                output.Write("<li>location = " + machine.Location() + "</li>\n");

                if (machine.Bin() != null)
                    output.Write("<li>bin containing " + machine.Bin() + "</li>\n");
                else
                    output.Write("<li>no bin</li>\n");

                output.Write("</ul>\n");
            }

            output.Write("<h2>Robot</h2>\n<ul>\n");
            if (robot.Location() != null)
                output.Write("<li>location = " + robot.Location().Name() + "</li>\n");

            if (robot.Bin() != null)
                output.Write("<li>bin containing " + robot.Bin() + "</li>\n");

            output.Write("</ul>\n");
        }
开发者ID:hamoriz,项目名称:katas,代码行数:29,代码来源:HtmlReport.cs

示例2: Simplify

 /// <summary>
 /// Simplify a collection of <c>TaggedLineString</c>s.
 /// </summary>
 /// <param name="taggedLines">The collection of lines to simplify.</param>
 public virtual void Simplify(IList taggedLines)
 {
     for (IEnumerator i = taggedLines.GetEnumerator(); i.MoveNext(); )
         _inputIndex.Add((TaggedLineString)i.Current);
     for (IEnumerator i = taggedLines.GetEnumerator(); i.MoveNext(); )
     {
         TaggedLineStringSimplifier tlss
                       = new TaggedLineStringSimplifier(_inputIndex, _outputIndex);
         tlss.DistanceTolerance = _distanceTolerance;
         tlss.Simplify((TaggedLineString)i.Current);
     }
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:16,代码来源:TaggedLinesSimplifier.cs

示例3: ComputeIntersections

 /// <summary>
 ///
 /// </summary>
 /// <param name="edges"></param>
 /// <param name="si"></param>
 /// <param name="testAllSegments"></param>
 public override void ComputeIntersections(IList edges, SegmentIntersector si, bool testAllSegments)
 {
     for (IEnumerator i0 = edges.GetEnumerator(); i0.MoveNext(); )
     {
         Edge edge0 = (Edge)i0.Current;
         for (IEnumerator i1 = edges.GetEnumerator(); i1.MoveNext(); )
         {
             Edge edge1 = (Edge)i1.Current;
             if (testAllSegments || edge0 != edge1)
                 ComputeIntersects(edge0, edge1, si);
         }
     }
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:19,代码来源:SimpleEdgeSetIntersector.cs

示例4: PerformOperations

 protected override void PerformOperations(IList<IAccount> selectedAccs)
 {
     // Decides about to perform a write or read operation.
       int res = rnd.Next(100);
       if (res < UpdatesTax) {
     WriteOperations(selectedAccs.GetEnumerator());
     nrOfWriteIterations++;
       }
       else {
     int totalBal = ReadOperations(selectedAccs.GetEnumerator());
     int avgBal = totalBal / selectedAccs.Count;
     if (avgBal > maxAvgBalance) maxAvgBalance = avgBal;
     nrOfReadIterations++;
       }
 }
开发者ID:AveProjVstm,项目名称:MonoVstmTests,代码行数:15,代码来源:WorkerNOTSync.cs

示例5: FindEdge

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dirEdgeList"></param>
        public void FindEdge(IList dirEdgeList)
        {
            /*
             * Check all forward DirectedEdges only.  This is still general,
             * because each edge has a forward DirectedEdge.
             */
            for (IEnumerator i = dirEdgeList.GetEnumerator(); i.MoveNext(); )
            {
                DirectedEdge de = (DirectedEdge) i.Current;
                if (!de.IsForward) continue;
                CheckForRightmostCoordinate(de);
            }

            /*
             * If the rightmost point is a node, we need to identify which of
             * the incident edges is rightmost.
             */
            Assert.IsTrue(minIndex != 0 || minCoord.Equals(minDe.Coordinate), "inconsistency in rightmost processing");
            if (minIndex == 0)
                 FindRightmostEdgeAtNode();
            else FindRightmostEdgeAtVertex();

            /*
             * now check that the extreme side is the R side.
             * If not, use the sym instead.
             */
            orientedDe = minDe;
            Positions rightmostSide = GetRightmostSide(minDe, minIndex);
            if (rightmostSide == Positions.Left)
                orientedDe = minDe.Sym;
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:35,代码来源:RightmostEdgeFinder.cs

示例6: SmallBlockTableWriter

        /// <summary>
        /// Initializes a new instance of the <see cref="SmallBlockTableWriter"/> class.
        /// </summary>
        /// <param name="documents">a IList of POIFSDocument instances</param>
        /// <param name="root">the Filesystem's root property</param>
        public SmallBlockTableWriter(POIFSBigBlockSize bigBlockSize, IList documents,
                                     RootProperty root)
        {
            _sbat = new BlockAllocationTableWriter(bigBlockSize);
            _small_blocks = new ArrayList();
            _root         = root;
            IEnumerator iter = documents.GetEnumerator();

            while (iter.MoveNext())
            {
                POIFSDocument   doc    = ( POIFSDocument ) iter.Current;
                BlockWritable[] blocks = doc.SmallBlocks;

                if (blocks.Length != 0)
                {
                    doc.StartBlock=_sbat.AllocateSpace(blocks.Length);
                    for (int j = 0; j < blocks.Length; j++)
                    {
                        _small_blocks.Add(blocks[ j ]);
                    }
                } else {
            	    doc.StartBlock=POIFSConstants.END_OF_CHAIN;
                }
            }
            _sbat.SimpleCreateBlocks();
            _root.Size=_small_blocks.Count;
            _big_block_count = SmallDocumentBlock.Fill(bigBlockSize, _small_blocks);
        }
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:33,代码来源:SmallBlockTableWriter.cs

示例7: StoreAll

		private void StoreAll(IList expected)
		{
			for (IEnumerator objIter = expected.GetEnumerator(); objIter.MoveNext(); )
			{
				object obj = objIter.Current;
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:BasicQLinTestCase.cs

示例8: Load

        public static IList<CommandArgument> Load(IList<string> arguments)
        {
            var ret = new List<CommandArgument>();

            var enumerator = arguments.GetEnumerator();
            if (!enumerator.MoveNext())
                return ret;

            while (true)
            {
                if (enumerator.Current.StartsWith("-"))
                {
                    var argument = enumerator.Current.Substring(1);
                    bool hasNext = enumerator.MoveNext();
                    string value = hasNext && !enumerator.Current.StartsWith("-") ? enumerator.Current : null;

                    ret.Add(new CommandArgument { Argument = argument, Value = value });

                    if (hasNext && enumerator.Current.StartsWith("-")) //Skip movenext
                        continue;
                }
                else
                {
                    ret.Add(new CommandArgument { Value = enumerator.Current });
                }

                if (!enumerator.MoveNext())
                    break;
            }

            return ret;
        }
开发者ID:hcesar,项目名称:Chess,代码行数:32,代码来源:CommandArgument.cs

示例9: ListEnumerator

 public ListEnumerator(IList list, int offset)
 {
     this.original = list;
     this.enumerator = list.GetEnumerator();
     this.offset = offset;
     this.AdjustOffset();
 }
开发者ID:ajlopez,项目名称:AjSharpure,代码行数:7,代码来源:ListEnumerator.cs

示例10: ToEdges

 /// <summary>
 /// Returns a List containing the parent Edge (possibly null) for each of the given
 /// DirectedEdges.
 /// </summary>
 /// <param name="dirEdges"></param>
 /// <returns></returns>
 public static IList ToEdges(IList dirEdges)
 {
     IList edges = new ArrayList();
     for (IEnumerator i = dirEdges.GetEnumerator(); i.MoveNext(); ) 
         edges.Add(((DirectedEdge) i.Current).parentEdge);            
     return edges;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:13,代码来源:DirectedEdge.cs

示例11: FindEdgeRingContaining

        /// <summary>
        /// Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
        /// The innermost enclosing ring is the <i>smallest</i> enclosing ring.
        /// The algorithm used depends on the fact that:
        /// ring A contains ring B iff envelope(ring A) contains envelope(ring B).
        /// This routine is only safe to use if the chosen point of the hole
        /// is known to be properly contained in a shell
        /// (which is guaranteed to be the case if the hole does not touch its shell).
        /// </summary>
        /// <param name="shellList"></param>
        /// <param name="testEr"></param>
        /// <returns>Containing EdgeRing, if there is one, OR
        /// null if no containing EdgeRing is found.</returns>
        public static EdgeRing FindEdgeRingContaining(EdgeRing testEr, IList shellList)
        {
            ILinearRing teString = testEr.Ring;
            IEnvelope testEnv = teString.EnvelopeInternal;

            EdgeRing minShell = null;
            IEnvelope minEnv = null;
            for (IEnumerator it = shellList.GetEnumerator(); it.MoveNext(); )
            {
                EdgeRing tryShell = (EdgeRing) it.Current;
                ILinearRing tryRing = tryShell.Ring;
                IEnvelope tryEnv = tryRing.EnvelopeInternal;
                if (minShell != null)
                    minEnv = minShell.Ring.EnvelopeInternal;
                bool isContained = false;
                // the hole envelope cannot equal the shell envelope
                if (tryEnv.Equals(testEnv)) continue;

                // ICoordinate testPt = PointNotInList(teString.Coordinates, tryRing.Coordinates);
                ICoordinate testPt = CoordinateArrays.PointNotInList(teString.Coordinates, tryRing.Coordinates);
                if (tryEnv.Contains(testEnv) && CGAlgorithms.IsPointInRing(testPt, tryRing.Coordinates))
                    isContained = true;
                // check if this new containing ring is smaller than the current minimum ring
                if (isContained)
                {
                    if (minShell == null || minEnv.Contains(tryEnv))
                        minShell = tryShell;
                }
            }
            return minShell;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:44,代码来源:EdgeRing.cs

示例12: NumericRange

 public NumericRange(IList<double> values)
 {
     double num3;
     double num4;
     double current;
     Func<double, double> selector = null;
     double num = 0.0;
     double num2 = 0.0;
     goto Label_016A;
     Label_00F1:
     using (IEnumerator<double> enumerator = values.GetEnumerator())
     {
         goto Label_011B;
     Label_00FB:
         if ((((uint) current) - ((uint) num)) > uint.MaxValue)
         {
             goto Label_0142;
         }
         num4 += current * current;
     Label_011B:
         if (!enumerator.MoveNext())
         {
             goto Label_0157;
         }
         current = enumerator.Current;
         num = Math.Max(num, current);
         num2 = Math.Min(num2, current);
     Label_0142:
         num3 += current;
         goto Label_00FB;
     }
     Label_0157:
     this._xdc8f3f8857bee4c6 = values.Count;
     this._x628ea9b89457a2a9 = num;
     this._xd12d1dba8a023d95 = num2;
     this._x0eb49ee242305597 = num3 / ((double) this._xdc8f3f8857bee4c6);
     this._xcce91100698a4514 = Math.Sqrt(num4 / ((double) this._xdc8f3f8857bee4c6));
     if (((((uint) num2) & 0) != 0) || ((((uint) num2) + ((uint) current)) >= 0))
     {
         if (selector == null)
         {
             selector = new Func<double, double>(this, (IntPtr) this.xf29670e286f5562f);
         }
         double num6 = values.Sum<double>(selector);
         this._x8db8a12c7e795fea = Math.Sqrt(num6 / ((double) this._xdc8f3f8857bee4c6));
         if ((((uint) current) + ((uint) num4)) > uint.MaxValue)
         {
             goto Label_00F1;
         }
         if ((((uint) num6) - ((uint) current)) <= uint.MaxValue)
         {
             return;
         }
     }
     Label_016A:
     num3 = 0.0;
     num4 = 0.0;
     goto Label_00F1;
 }
开发者ID:neismit,项目名称:emds,代码行数:59,代码来源:NumericRange.cs

示例13: PredictiveMaintenanceTelemetry

 public PredictiveMaintenanceTelemetry(IConfigurationProvider config, ILogger logger, string deviceId, IList<ExpandoObject> dataset)
 {
     _config = config;
     _logger = logger;
     _deviceId = deviceId;
     _active = false;
     _data = dataset.GetEnumerator();
 }
开发者ID:b3540,项目名称:azure-iot-predictive-maintenance,代码行数:8,代码来源:PredictiveMaintenanceTelemetry.cs

示例14: AddCurves

 /// <summary>
 /// 
 /// </summary>
 /// <param name="lineList"></param>
 /// <param name="leftLoc"></param>
 /// <param name="rightLoc"></param>
 private void AddCurves(IList lineList, Locations leftLoc, Locations rightLoc)
 {
     for (IEnumerator i = lineList.GetEnumerator(); i.MoveNext(); )
     {
         ICoordinate[] coords = (ICoordinate[]) i.Current;
         AddCurve(coords, leftLoc, rightLoc);
     }
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:14,代码来源:OffsetCurveSetBuilder.cs

示例15: Add

 /// <summary>
 /// 
 /// </summary>
 /// <param name="edges"></param>
 /// <param name="edgeSet"></param>
 private void Add(IList edges, object edgeSet)
 {
     for (IEnumerator i = edges.GetEnumerator(); i.MoveNext(); ) 
     {
         Edge edge = (Edge) i.Current;
         Add(edge, edgeSet);
     }
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:13,代码来源:SimpleSweepLineIntersector.cs


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