本文整理汇总了C#中Queue.EnqueueRange方法的典型用法代码示例。如果您正苦于以下问题:C# Queue.EnqueueRange方法的具体用法?C# Queue.EnqueueRange怎么用?C# Queue.EnqueueRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue.EnqueueRange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSubPageActive
private object GetSubPageActive()
{
if (this.BookPage.SubPages == null)
{
return false;
}
// If this page is active, then no sub pages are active.
//
if (this.BookPage.Document == this.ActiveDocument)
{
return false;
}
var pages = new Queue<BookPage>(this.BookPage.SubPages);
while (pages.Count > 0)
{
var page = pages.Dequeue();
if (page.Document == this.ActiveDocument)
{
return true;
}
if (page.SubPages != null)
{
pages.EnqueueRange(page.SubPages);
}
}
return false;
}
示例2: Compile
public override ExecutionEnvironment Compile(string source, string input)
{
var inputQ = new Queue<BigInteger>();
switch (_settings.InputType)
{
case IOType.Numbers: try
{
inputQ.EnqueueRange(input.Split(',').Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => BigInteger.Parse(s)));
}
catch (FormatException)
{
throw new Exception("Please provide the input as a comma-separated sequence of integers (or change the semantics in the Semantics menu).");
}
break;
case IOType.Characters:
inputQ.EnqueueRange(input.Select(ch => (BigInteger) (int) ch));
break;
default:
throw new InvalidOperationException();
}
return BrainfuckEnv.GetEnvironment(_settings.CellType, source, inputQ, _settings.OutputType);
}
示例3: featuresTree_AfterCheck
void featuresTree_AfterCheck(object sender, TreeViewEventArgs e)
{
if (isAutoCheckingActive)
{
isAutoCheckingActive = false;
bool newState = e.Node.Checked;
var queue = new Queue<TreeNode>();
queue.EnqueueRange(e.Node.Nodes.ToArray());
while (queue.Any())
{
var node = queue.Dequeue();
node.Checked = newState;
queue.EnqueueRange(node.Nodes.ToArray());
}
isAutoCheckingActive = true;
}
}
示例4: AllContributingFiles
public IEnumerable<SourceFile> AllContributingFiles()
{
var set = new HashSet<SourceFile>();
var all = new Queue<SourceFile>(this.ContributingFiles);
while (all.Count > 0)
{
var file = all.Dequeue();
if (set.Add(file))
{
all.EnqueueRange(file.ContributingFiles);
}
}
return set;
}
示例5: GetPlaceholderCells
public IEnumerable<GridCell> GetPlaceholderCells()
{
var result = new List<GridCell>();
var rows = new Queue<GridRow>();
rows.EnqueueRange(_rows);
while (rows.Count > 0)
{
var row = rows.Dequeue();
foreach (var cell in row.Cells)
{
if (cell.Type == GridLayoutCellType.Placeholder)
result.Add(cell);
else if (cell.Type == GridLayoutCellType.InnerGrid)
{
var grid = (GridLayout) cell;
rows.EnqueueRange(grid.Rows);
}
}
}
return result;
}
示例6: RebuildSearchIndex
public void RebuildSearchIndex()
{
using (var service = new CrawlService("site"))
{
service.ClearDatabase();
}
Queue<Page> pages = new Queue<Page>();
using (CmsContext.Published)
{
var siteRoots = CmsService.Instance.SelectItems<SiteRoot>("/Content/*/*{SiteRoot}");
pages.EnqueueRange(siteRoots.SelectMany(r => r.GetChildren<Page>()));
while (pages.Count > 0)
{
var page = pages.Dequeue();
if (page.Template.Path.StartsWith("/WebPage"))
{
var site = CmsService.Instance.GetSitePath(page.Path).Split('/').Last();
var thumbnail = page.GetValue<Image>("thumbnail");
SearchBackgroundCrawler.QueueDocumentAdd(site, page, thumbnail.Exists ? thumbnail.Url : string.Empty);
}
pages.EnqueueRange(page.GetChildren<Page>());
}
}
}
示例7: AllChapters
private static IEnumerable<BookPage> AllChapters(Book book)
{
var queue = new Queue<BookPage>(book.Chapters);
while (queue.Count > 0)
{
var page = queue.Dequeue();
if (page.Chapter)
{
queue.EnqueueRange(page.SubPages);
yield return page;
}
}
}