本文整理汇总了C#中Fields.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# Fields.GetEnumerator方法的具体用法?C# Fields.GetEnumerator怎么用?C# Fields.GetEnumerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fields
的用法示例。
在下文中一共展示了Fields.GetEnumerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertFieldsEquals
/// <summary>
/// Fields api equivalency
/// </summary>
public void AssertFieldsEquals(string info, IndexReader leftReader, Fields leftFields, Fields rightFields, bool deep)
{
// Fields could be null if there are no postings,
// but then it must be null for both
if (leftFields == null || rightFields == null)
{
Assert.IsNull(leftFields, info);
Assert.IsNull(rightFields, info);
return;
}
AssertFieldStatisticsEquals(info, leftFields, rightFields);
IEnumerator<string> leftEnum = leftFields.GetEnumerator();
IEnumerator<string> rightEnum = rightFields.GetEnumerator();
while (leftEnum.MoveNext())
{
string field = leftEnum.Current;
rightEnum.MoveNext();
Assert.AreEqual(field, rightEnum.Current, info);
AssertTermsEquals(info, leftReader, leftFields.Terms(field), rightFields.Terms(field), deep);
}
Assert.IsFalse(rightEnum.MoveNext());
}
示例2: TestFields
private void TestFields(Fields fields)
{
IEnumerator<string> iterator = fields.GetEnumerator();
while (iterator.MoveNext())
{
var dummy = iterator.Current;
// .NET: Testing for iterator.Remove() isn't applicable
}
Assert.IsFalse(iterator.MoveNext());
// .NET: Testing for NoSuchElementException with .NET iterators isn't applicable
}