Question: I want to display the contents of collection in list by foreach loop but variables (name) and (age) do not match in foreach loop.

```
string name;
float age;
List<universe> collection = new List<universe>();
universe main = new universe();
for (int i = 0; i < 10; i++)
{
    Console.WriteLine("name");
    name = Console.ReadLine();
    Console.WriteLine("age");
    age = float.Parse(Console.ReadLine());
    main.Galaxy(name, age);
    collection.Add(main);
}
foreach (universe b in collection) 
{
    Console.WriteLine(main.Galaxy(name, age));
}

```

I've tried to make a list of (main) but I coudn't.

Answer: 
Try something like this:

```
string name;
float age;
List<universe> collection = new List<universe>();

for (int i = 0; i < 10; i++)
{
    universe main = new universe();

    Console.WriteLine("name");
    name = Console.ReadLine();
    Console.WriteLine("age");
    age = float.Parse(Console.ReadLine());
    main.Galaxy(name, age);
    collection.Add(main);
}

foreach (universe b in collection) 
{
    Console.WriteLine($"{b.Name} {b.Age}"); // <== I don't know if universe class has Name and Age properties
}

```
Use this

```
static void Main(string[] args)
    {
        string name;
        float age;
        List<universe> collection = new List<universe>();
        universe main = new universe();
        for (int i = 0; i < 2; i++)
        {
            Console.WriteLine("name");
            name = Console.ReadLine();
            Console.WriteLine("age");
            age = float.Parse(Console.ReadLine());
            main.Galaxy(name, age);
            collection.Add(main);
        }
        foreach (universe b in collection)
        {
            Console.WriteLine("name =" + b.Name + " Age=" + b.Age);
        }
        Console.ReadKey();
    }

```