---
# System prepended metadata

title: partners

---

# partners

```c#
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        List<Person> people = new List<Person>();

        // Create 20 random people
        for (int i = 0; i < 20; i++)
        {
            Person person = new Person();
            person.Name = "Person " + i;
            person.Age = new Random().Next(18, 65); // Random age between 18 and 64

            // Random animal
            Animal animal = new Animal();
            animal.Name = "Animal " + i;
            animal.Kind = (AnimalKind)new Random().Next(0, 3); // Random animal kind
            person.Animal = animal;

            people.Add(person);
        }

        // Randomly assign partners
        for (int i = 0; i < people.Count; i++)
        {
            int partnerIndex = new Random().Next(0, people.Count);
            if (partnerIndex != i)
            {
                people[i].Partner = people[partnerIndex];
            }
        }

        // Print all people
        foreach (Person person in people)
        {
            Console.WriteLine(person);
        }
    }
}

class Person
{
    public string Name { get; set; }
    public int Age { get; set; }
    public Animal Animal { get; set; }
    public Person Partner { get; set; }

    public override string ToString()
    {
        string partnerName = Partner != null ? Partner.Name : "none";
        return $"Name: {Name}, Age: {Age}, Animal: {Animal}, Partner: {partnerName}";
    }
}

class Animal
{
    public string Name { get; set; }
    public AnimalKind Kind { get; set; }

    public override string ToString()
    {
        return $"{Name} ({Kind})";
    }
}

enum AnimalKind
{
    Dog,
    Cat,
    Bird,
    Fish
}
```