How to copy values from nested list into new list

How to copy values from nested list into new list

I have a nested list that contains

I have a nested list that contains

public class Person
{
    public Person(string name)
    {
        this.Name = name;
    }

public string Name { get; set; }

public List<Person> Childs { get; set; }

}

The list can be used like:

var Persons = new List<Person>();
Persons.Add(new Person("Eric"));
Persons[0].Childs = new List<Person>();
Persons[0].Childs.Add(new Person("Tom"));
Persons[0].Childs.Add(new Person("John"));
Persons[0].Childs[0].Childs = new List<Person>();
Persons[0].Childs[0].Childs.Add(new Person("Bill"));
Persons.Add(new Person("John");

Now I have this class:

public class Human
{
    public string Name { get; set; }

public int Age { get; set; }

public List&lt;Human&gt; SubHuman { get; set; }

}

Lets say the Persons list was created. How can I now create a new list Humans out of the Persons list (iterate over the list) whereas the name of each Human is the name of the appropriate Person?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

C/C++ vs. Rust: A developer’s perspective

In this post, you'll see the difference between Rust and C/C++ in a developer’s perspective

Variable Introduction in C#[Bangla]

LIKE | COMMENT | SHARE | SUBSCRIBE A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C# has a speci...