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


C# IEnumerator.Next方法代码示例

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


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

示例1: CopyStreamsToFolder

 /// <exception cref="System.IO.IOException"></exception>
 public static void CopyStreamsToFolder(IEnumerator<KeyValuePair<string, InputStream     >> streams, FilePath folder)
 {
     while (streams.HasNext())
     {
         KeyValuePair<string, InputStream> entry = streams.Next();
         FilePath file = new FilePath(folder, entry.Key);
         CopyStreamToFile(entry.Value, file);
     }
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:10,代码来源:StreamUtils.cs

示例2: Marshal

 public object Marshal(IEnumerator<string> currentArgument)
 {
     try
     {
         return currentArgument.Next();
     }
     catch (InvalidOperationException)
     {
         throw new ArgsException(ErrorCode.MissingString);
     }
 }
开发者ID:orient-man,项目名称:CSharpArgs2,代码行数:11,代码来源:StringArgumentMarshaler.cs

示例3: TestFieldNonExistent

        public void TestFieldNonExistent()
        {
            try
            {
                indexReader = IndexReader.Open(store, true);

                ld = new LuceneDictionary(indexReader, "nonexistent_field");
                it = ld.GetWordsIterator();

                AssertFalse("More elements than expected", it.HasNext());
                AssertTrue("Nonexistent element is really null", it.Next() == null);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:17,代码来源:TestLuceneDictionary.cs

示例4: Marshal

        public object Marshal(IEnumerator<string> currentArgument)
        {
            string parameter = null;

            try
            {
                parameter = currentArgument.Next();
                return Int32.Parse(parameter);
            }
            catch (InvalidOperationException)
            {
                throw new ArgsException(ErrorCode.MissingInteger);
            }
            catch (FormatException)
            {
                throw new ArgsException(ErrorCode.InvalidInteger, errorParameter: parameter);
            }
        }
开发者ID:orient-man,项目名称:CSharpArgs2,代码行数:18,代码来源:IntArgumentMarshaler.cs

示例5: Marshal

        public object Marshal(IEnumerator<string> currentArgument)
        {
            string parameter = null;

            try
            {
                parameter = currentArgument.Next();
                return double.Parse(parameter, CultureInfo.InvariantCulture);
            }
            catch (InvalidOperationException)
            {
                throw new ArgsException(ErrorCode.MissingDouble);
            }
            catch (FormatException)
            {
                throw new ArgsException(ErrorCode.InvalidDouble, errorParameter: parameter);
            }
        }
开发者ID:orient-man,项目名称:CSharpArgs2,代码行数:18,代码来源:DoubleArgumentMarshaler.cs

示例6: TestFieldAaa

        public void TestFieldAaa()
        {
            try
            {
                indexReader = IndexReader.Open(store);

                ld = new LuceneDictionary(indexReader, "aaa");
                it = ld.GetWordsIterator();

                AssertTrue("First element doesn't exist.", it.HasNext());
                AssertTrue("First element isn't correct", it.Next().Equals("foo"));
                AssertFalse("More elements than expected", it.HasNext());
                AssertTrue("Nonexistent element is really null", it.Next() == null);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:19,代码来源:TestLuceneDictionary.cs

示例7: TestFieldContents_2

        public void TestFieldContents_2()
        {
            try
            {
                indexReader = IndexReader.Open(store);

                ld = new LuceneDictionary(indexReader, "contents");
                it = ld.GetWordsIterator();
                
                // hasNext() should have no side effects //{{DIGY}} But has. Need a fix?
                //AssertTrue("First element isn't were it should be.", it.HasNext());
                //AssertTrue("First element isn't were it should be.", it.HasNext());
                //AssertTrue("First element isn't were it should be.", it.HasNext());

                // just iterate through words
                AssertTrue("First element isn't correct", it.Next().Equals("Jerry"));
                AssertTrue("Second element isn't correct", it.Next().Equals("Tom"));
                AssertTrue("Nonexistent element is really null", it.Next() == null);

                // hasNext() should still have no side effects ...
                AssertFalse("There should be any more elements", it.HasNext());
                AssertFalse("There should be any more elements", it.HasNext());
                AssertFalse("There should be any more elements", it.HasNext());

                // .. and there are really no more words
                AssertTrue("Nonexistent element is really null", it.Next() == null);
                AssertTrue("Nonexistent element is really null", it.Next() == null);
                AssertTrue("Nonexistent element is really null", it.Next() == null);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:34,代码来源:TestLuceneDictionary.cs

示例8: TestFieldContents_1

        public void TestFieldContents_1()
        {
            try
            {
                indexReader = IndexReader.Open(store);

                ld = new LuceneDictionary(indexReader, "contents");
                it = ld.GetWordsIterator();

                AssertTrue("First element doesn't exist.", it.HasNext());
                AssertTrue("First element isn't correct", it.Next().Equals("Jerry"));
                AssertTrue("Second element doesn't exist.", it.HasNext());
                AssertTrue("Second element isn't correct", it.Next().Equals("Tom"));
                AssertFalse("More elements than expected", it.HasNext());
                AssertTrue("Nonexistent element is really null", it.Next() == null);

                ld = new LuceneDictionary(indexReader, "contents");
                it = ld.GetWordsIterator();

                int counter = 2;
                while (it.HasNext())
                {
                    it.Next();
                    counter--;
                }

                AssertTrue("Number of words incorrect", counter == 0);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:33,代码来源:TestLuceneDictionary.cs

示例9: MakeLeafNodes

        private IEnumerable<KeyValuePair<byte[], ulong >> MakeLeafNodes(ulong txnId, IEnumerator<KeyValuePair<byte[], byte[]>> orderedValues, BrightstarProfiler profiler = null)
        {
            ILeafNode prevNode = MakeLeafNode(txnId, orderedValues.Next(_leafLoadFactor));
            if (prevNode.KeyCount < _leafLoadFactor)
            {
                // There were only enough values to fill a single leaf node
                yield return WriteNode(txnId, prevNode, profiler);
                yield break;
            }
            ILeafNode nextNode = MakeLeafNode(txnId, orderedValues.Next(_leafLoadFactor));
            do
            {
                if (nextNode.KeyCount >= _config.LeafSplitIndex)
                {
                    yield return WriteNode(txnId, prevNode, profiler);
                }
                else
                {
                    // Final leaf node needs to share some values from the previous node we created
                    nextNode.RedistributeFromLeft(txnId, prevNode);
                    yield return WriteNode(txnId, prevNode, profiler);
                }
                prevNode = nextNode;
                var nextKeys = orderedValues.Next(_leafLoadFactor).ToList();
                nextNode = nextKeys.Count > 0 ? MakeLeafNode(txnId, nextKeys) : null;
            } while (nextNode != null);

            yield return WriteNode(txnId, prevNode, profiler);
        }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:29,代码来源:BPlusTreeBuilder.cs

示例10: CompareIterators

		private void CompareIterators(IEnumerator it1, IEnumerator it2)
		{
			while (it1.HasNext())
			{
				NUnit.Framework.Assert.AreEqual(it1.Next(), it2.Next());
			}
			NUnit.Framework.Assert.IsFalse(it2.HasNext());
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:Bug466207Test.cs

示例11: MakeInternalNode

 private InternalNode MakeInternalNode(KeyValuePair<byte[], ulong> firstChild, IEnumerator<KeyValuePair<byte[], ulong>> enumerator, int internalBranchFactor)
 {
     var nodePage = _pageStore.Create();
     var childPointers = new List<ulong>(internalBranchFactor + 1) {firstChild.Value};
     var keys = new List<byte[]>();
     var kvpList = enumerator.Next(_internalBranchFactor).ToList();
     foreach (var keyValuePair in kvpList)
     {
         childPointers.Add(keyValuePair.Value);
         var key = new byte[_config.KeySize];
         Array.Copy(keyValuePair.Key, key, _config.KeySize);
         keys.Add(key);
     }
     /*
     for (int i = 0; i < kvpList.Count; i++)
     {
         childPointers.Add(enumerator.Current.Value);
         keys.Add(new byte[_config.KeySize]);
         Array.Copy(enumerator.Current.Key, keys[i], _config.KeySize);
     }
      */
     return new InternalNode(nodePage, keys, childPointers, _config);
 }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:23,代码来源:BPlusTreeBuilder.cs

示例12: CompareIterators

		private void CompareIterators(IEnumerator it1, IEnumerator it2)
		{
			NUnit.Framework.Assert.IsTrue(map.Count == 4);
			while (it1.HasNext())
			{
				NUnit.Framework.Assert.AreEqual(it1.Next(), it2.Next());
				it1.Remove();
				it2.Remove();
			}
			NUnit.Framework.Assert.IsTrue(map.IsEmpty());
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:11,代码来源:Bug448816Test.cs


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