Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another C# implementation.

Other implementations
type Tree struct {
	Key keyType
	Deco valueType
	Children []*Tree
struct Node(T){
    Node[] children;
    T data;

alias TreeOfIntegers = Node!(int);
class Node<T> {
  final T value;
  final List<Node<T>> children;
  Node(this.value, this.children);
  TTree = class
    Children: array of TTree;
    Data: TObject;
  TTree<_T> = class(TObject)
    Children: array of TObject;
    Data: _T;

  TStringTree = specialize TTree<String>;
data Tree a = Node {
    value :: a,
    children :: [Tree a]
Node =
parent =[])
parent.children <<[])
class Node:
    def __init__(self, value, *children):
        self.value = value
        self.children = list(children)
#include <vector>
template<typename T>
struct Node{
  T value;
  std::vector<Node<T>> children;
import java.util.List;
import java.util.ArrayList;
class Tree<K,V> {
  K key;
  V deco;
  List<Tree<K,V>> children = new ArrayList<>();
struct Node<T> {
  value: T,
  children: Vec<Node<T>>,
typedef struct node_s
    int value;
    struct node_s *nextSibling;
    struct node_s *firstChild;
} node_t;
(define (make-tree value children)
  (cons value children))

(define (tree-value t) (car t))
(define (tree-first-child t) (cadr t))
(define (tree-rest-children t) (cddr t))
local function Tree(v, c)
	return {
		val = v,
		children = c
class Tree
    public $children = [];
    public $data;
    public function __construct($data, $children)
        $this->data = $data;
        $this->children = $children;
class Node {
  constructor (value, children = []) {
    this.value = value
    this.children = children
case class Node[T](value: T, children: List[Node[T]] = Nil)
type 'a Tree = {
	value: 'a;
	children: 'a tree list;
my $tree = {
           'Root' => {
                 'Child1' => {
                       'GrandChild1' => {},
                       'GrandChild2' => {}
                 'Child2' => {}
type node_t
  integer:: value
  type(node_t), pointer :: next_sibling;
  type(node_t), pointer :: first_child;
end type node_t
-record( node,{
	value         :: any(),
	children = [] :: [node#{}]
@import Foundation;
@interface Node:NSObject
@property id value; // id means any object value
@property NSMutableArray *children;

// usage like
Node *n=[Node new];
[n.children addObject:otherNode];
[n.children removeLastObject];

// somewhere needed also
@implementation Node
-(instancetype)init {
  if (!(self=[super init])) return nil;
  _children=[NSMutableArray array];
  return self;