Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# walk down a tree and back

public static IEnumerable<T> Traverse<T>(T item, Func<T, IEnumerable<T>> childSelector)
{
    var stack = new Stack<T>();
    stack.Push(item);
    while (stack.Any())
    {
        var next = stack.Pop();
        yield return next;
        foreach (var child in childSelector(next))
            stack.Push(child);
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity dictionary foreach remove 
Csharp :: xamarin forms uwp button hover 
Csharp :: c sharp Enum class 
Csharp :: c# bitwise xor 
Csharp :: htmlgenericcontrol class c# 
Csharp :: unitydont play sound until finsihed 
Csharp :: windowsform mail sender app 
Csharp :: calculated field gridview asp.net 
Csharp :: open and close autocad api 
Csharp :: .net mvc foreach with index 
Csharp :: C# pull appart property chain in expression 
Csharp :: c# words return first 20 items of array 
Csharp :: get all the file from directory except txt in c# 
Csharp :: c# string is all zeros 
Csharp :: textbox center align winform 
Csharp :: design pattern for so many conditions c# 
Csharp :: permutation and combination program in c# 
Csharp :: translate english to spanish 
Csharp :: how to disable button until the value is selected c# 
Csharp :: how to convert command line argument to int in C# 
Csharp :: how to make your player movr the way you are rotated in unity 
Csharp :: save checkbox value to database c# 
Csharp :: input string was not in a correct format convert to double 
Csharp :: ef core identity get user with relationships 
Csharp :: lexicographically sorted 
Csharp :: imagetarget found event vuforia c# 
Csharp :: asp.net mvc table array binding arbitrary indices 
Csharp :: c# check if value in dictionary are unique 
Csharp :: ip validation .net core 
Csharp :: upcasting and downcasting in c# 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =