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


C# Page.Skip方法代码示例

本文整理汇总了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);
        }
开发者ID:malacandrian,项目名称:fyp,代码行数:22,代码来源:FindInterface.cs

示例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(); }
        }
开发者ID:malacandrian,项目名称:fyp,代码行数:22,代码来源:FindInterface.cs


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