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


C# Tree.ToList方法代码示例

本文整理汇总了C#中Tree.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.ToList方法的具体用法?C# Tree.ToList怎么用?C# Tree.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tree的用法示例。


在下文中一共展示了Tree.ToList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TraverseTree

        protected static IEnumerable<string> TraverseTree(Tree tree)
        {
            foreach (TreeEntry item in tree.ToList())
            {
                if (item.TargetType == TreeEntryTargetType.Blob)
                {
                    var blob = (Blob)item.Target;
                    yield return (item.Path);
                }

                if (item.TargetType == TreeEntryTargetType.Tree)
                {
                    var subTree = (Tree)item.Target;
                    foreach (var result in TraverseTree(subTree))
                    {
                        yield return result;
                    }
                }
            }
        }
开发者ID:st1pps,项目名称:Wyam,代码行数:20,代码来源:GitBase.cs

示例2: FindPath

 public static void FindPath(Tree<int> currentNode, List<Tree<int>> currentPath) {
     if (currentNode.Children.Count == 0)
     {
         allPaths.Push(currentPath);
         return;
     }
     else
     {
         foreach (var child in currentNode.Children)
         {
             Tree<int>[] newPathArray = new Tree<int>[currentPath.Count];
             currentPath.CopyTo(newPathArray);
             List<Tree<int>> newPath = newPathArray.ToList();
             newPath.Add(child);
             FindPath(child, newPath);
         }
     }
 }
开发者ID:straho99,项目名称:Data-Structures---homeworks,代码行数:18,代码来源:TreeApp.cs

示例3: GetTreeModelsWithDetails

        private IEnumerable<RepositoryTreeDetailModel> GetTreeModelsWithDetails(Commit commit, Tree tree, string referenceName)
        {
            var ancestors = _repository.Commits.QueryBy(new CommitFilter { Since = commit, SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Reverse }).ToList();
            var entries = tree.ToList();
            var result = new List<RepositoryTreeDetailModel>();

            for (int i = 0; i < ancestors.Count && entries.Any(); i++)
            {
                var ancestor = ancestors[i];

                for (int j = 0; j < entries.Count; j++)
                {
                    var entry = entries[j];
                    var ancestorEntry = ancestor[entry.Path];
                    if (ancestorEntry != null && entry.Target.Sha == ancestorEntry.Target.Sha)
                    {
                        result.Add(CreateRepositoryDetailModel(entry, ancestor, referenceName));
                        entries[j] = null;
                    }
                }

                entries.RemoveAll(entry => entry == null);
            }

            return result;
        }
开发者ID:kogot,项目名称:Bonobo-Git-Server,代码行数:26,代码来源:RepositoryBrowser.cs


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