Elements in array of user-defined type all change when one changes : <p>There is an illogical change happening in my array called "animals". Whenever I change one element in the array, all the other elements change along with it. I have no idea why this is happening.</p>

<p>When I run the program below, the console writes</p>

<pre><code>Sugar, Dog
Sugar, Dog
</code></pre>

<p>That should not be happening. I should be getting </p>

<pre><code>Fluffy, Cat
Sugar, Dog
</code></pre>

<p>Please look at the relevant code below:</p>

<pre><code>//Program.cs
namespace AnimalProgram
{
    class Program
    {
        static void Main(string[] args)
        {           
            AnimalInfo vitalStats = new AnimalInfo("vital statistics", new string[] { "name", "sex", "species", "breed", "age" }); //name, species, breed, sex, age.
            AnimalInfo veterinarian = new AnimalInfo("veterinarian", new string[] { "Vet Name", "Name of Vet's Practice" });

        List&lt;AnimalInfo&gt; animalStats = new List&lt;AnimalInfo&gt; {vitalStats, veterinarian };

        Animal cat1 = new Animal();
        Animal dog1 = new Animal();

        Animal[] animals = new Animal[2] { cat1, dog1};

        for(int i = 0; i &lt; animals.Count(); i++) animals[i].initializeAnimalInfo(animalStats);

        AnimalInfo cat1vitals= new AnimalInfo("vital statistics", new string[] { "Fluffy", "F", "Cat", "American Shorthair", "5" });
        AnimalInfo dog1vitals = new AnimalInfo("vital statistics", new string[] { "Sugar", "F", "Dog", "Great Dane", "7" });
        AnimalInfo cat1vet = new AnimalInfo("veterinarian", new string[] { "Joe Schmoe", "Joe's Veterinary" });
        AnimalInfo dog1vet = new AnimalInfo("veterinarian", new string[] { "Jim Blow", "Jim's Garage" });

        cat1.UpdateAnimalInfo(new List&lt;AnimalInfo&gt;() { cat1vitals, cat1vet });
        dog1.UpdateAnimalInfo(new List&lt;AnimalInfo&gt;() { dog1vitals, dog1vet });

        Console.WriteLine(cat1.animalProperties[0].info[0] + ", " + cat1.animalProperties[0].info[2]);
        Console.WriteLine(dog1.animalProperties[0].info[0] + ", " + dog1.animalProperties[0].info[2]);

        Console.ReadLine();
    }
}
</code></pre>

<p>}</p>

<pre><code>//Animal.cs
using System.Collections.Generic;
using System.Linq;

namespace AnimalProgram
{

class Animal
{

    public List&lt;AnimalInfo&gt; animalProperties;

    public Animal() {  }

    public void initializeAnimalInfo(List&lt;AnimalInfo&gt; aInfo)
    {
        animalProperties = aInfo;
    }

    public void UpdateAnimalInfo(List&lt;AnimalInfo&gt; targetInfo)
    {
        for (int i = 0; i &lt; targetInfo.Count(); i++)
            animalProperties[i].info = targetInfo[i].info;
    }

}
</code></pre>

<p>}</p>

<pre><code>//AnimalInfo.cs
namespace AnimalProgram
{
    public class AnimalInfo
    {
        public string infoName;
        public string [] info;

    public AnimalInfo(string iName, string [] information)
    {
        infoName = iName;
        info = information;
    }
}
</code></pre>

<p>}</p>
