本文整理汇总了C#中Page.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# Page.Skip方法的具体用法?C# Page.Skip怎么用?C# Page.Skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.Skip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchPages
/// <summary>
/// Recursively search every page in an array for a phrase, returning when it has been found
/// </summary>
/// <param Name="pages">The list of pages to search</param>
/// <param Name="location">Where to start the search</param>
/// <param Name="phrase">The phrase to search for</param>
/// <param Name="reverse">Whether the search should be backwards</param>
/// <returns>The location the phrase was found in, or null if it wasn't found</returns>
protected static Location SearchPages(Page[] pages, Location location, string phrase, bool reverse)
{
//Search for the phrase, and return it if found
Location output = SearchPage(location, phrase, reverse);
if (output != null) { return output; }
//Remove the first item of the array and return null if no pages remain
Page[] newPages = pages.Skip(1).ToArray();
if (newPages.Length == 0) { return null; }
//Start the next recursion
Location newLocation = new Location(location.Window, location.Document, newPages[0], null);
return SearchPages(newPages, newLocation, phrase, reverse);
}
示例2: OrderPages
/// <summary>
/// Reorders an array of pages to the correct order for searching through
/// </summary>
/// <param Name="pages">The array of pages to search</param>
/// <param Name="startPage">The page to start on. Null indicates all pages should be searched</param>
/// <param Name="reverse">The direction the search should happen in</param>
/// <returns>The reorded array</returns>
protected static Page[] OrderPages(Page[] pages, int? startPage, bool reverse)
{
//If it needs to scan everything, make sure it starts in the right place
if (startPage == null)
{
if (!reverse) { startPage = 0; }
else { startPage = pages.Length - 1; }
}
//If the search is forwards, take only the start page and following pages
if (!reverse) { return pages.Skip((int)startPage).ToArray(); }
//If the search is backwards, take only the start page and preceding pages, then reverse the order
else { return pages.Take((int)startPage + 1).Reverse().ToArray(); }
}