本文整理汇总了C#中System.Windows.Forms.Document.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Skip方法的具体用法?C# Document.Skip怎么用?C# Document.Skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.Skip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchDocuments
/// <summary>
/// Recursively search all documents for a phrase
/// </summary>
/// <param Name="documents">The list of documents to search</param>
/// <param Name="location">The location to start searching in</param>
/// <param Name="phrase">The phrase to search for</param>
/// <param Name="reverse">Whether the search should be backwards</param>
/// <returns>The location of the phrase, or null if not found</returns>
protected static Location SearchDocuments(Document[] documents, Location location, string phrase, bool reverse)
{
//Search for the phrase, and return if found
Location output = SearchDocument(location, phrase, reverse);
if (output != null) { return output; }
//Remove the first document fro the array, and exit if no documents remain
Document[] newDocuments = documents.Skip(1).ToArray();
if (newDocuments.Length == 0) { return null; }
//Begin the next recursion
Location newLocation = new Location(location.Window, newDocuments[0], null, null);
return SearchDocuments(newDocuments, newLocation, phrase, reverse);
}
示例2: OrderDocuments
/// <summary>
/// Order documents for searching
/// </summary>
/// <param Name="documents">The list of documents to search</param>
/// <param Name="startDoc">The index of the document to start searching at</param>
/// <param Name="reverse">Whether the search should be backwards</param>
/// <returns></returns>
protected static Document[] OrderDocuments(Document[] documents, int startDoc, bool reverse)
{
//If the search is backwards, reverse the list
//And update the startDoc pointer to the new location
if (reverse)
{
documents = documents.Reverse().ToArray();
startDoc = documents.Length - startDoc - 1;
}
//Reorder the list such that all documents from before the start document
//are removed and added to the end of the list
return documents.Skip(startDoc).Concat(documents.Take(startDoc + 1)).ToArray();
}