本文整理匯總了C#中XCore.List.GetRange方法的典型用法代碼示例。如果您正苦於以下問題:C# List.GetRange方法的具體用法?C# List.GetRange怎麽用?C# List.GetRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XCore.List
的用法示例。
在下文中一共展示了List.GetRange方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CombineSegs
/// <summary>
/// Return a list of the combined segments in the two lists, ordered by BeginOffset.
/// </summary>
/// <param name="cachedSegments"></param>
/// <param name="paraSegments"></param>
/// <returns></returns>
private List<int> CombineSegs(List<int> first, List<int> second)
{
List<int> result = new List<int>(first.Count + second.Count);
int index1 = 0;
int index2 = 0;
while (index1 < first.Count && index2 < second.Count)
{
if (first[index1] == second[index2])
{
// same segment in both...transfer
result.Add(first[index1]);
index1++;
index2++;
continue;
}
int offset1 = m_cache.GetIntProperty(first[index1], (int) CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginOffset);
int offset2 = m_cache.GetIntProperty(second[index2], (int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginOffset);
if (offset1 < offset2)
{
result.Add(first[index1]);
index1++;
}
else
{
result.Add(second[index2]);
index2++;
}
}
if (index1 < first.Count)
result.AddRange(first.GetRange(index1, first.Count - index1));
else if (index2 < second.Count)
result.AddRange(second.GetRange(index2, second.Count - index2));
return result;
}