How can I use an object in a different class?
<p>I've been messing around in C# a little bit and I've stumbled into a problem for which I haven't managed to find an answer. I created two objects in main from another .cs file and I would like to assign a value for a variable associated with the object in another class. After about an hour of looking, I have no idea how to do it. Here is my code (I know it's not perfect; I'm just starting to learn):</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Converse
{
class Program
{
    static void Main(string[] args)
    {

        Subject subject1 = new Subject();
        Subject subject2 = new Subject();

        Generate.generation();

    }
}
}
</code></pre>

<p>Then</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Converse
{
public class Subject
{
    public int persuasion;

    public Subject()
    {
        persuasion = 0;
    }
}
}
</code></pre>

<p>And on this last one, lines 17 and 19 are the problem:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Converse
{
public static class Generate
{
   public static void generation()
   {
       Console.WriteLine("Control over Subject  1's personality? ");
       Console.WriteLine("1) None");
       Console.WriteLine("2) Minimal");
       Console.WriteLine("3) Considerable");

       subject1.persuasion = Console.ReadKey();

       switch (subject1.persuasion)
       {
           case 1:
               break;

           case 2:
               GenerationFunctions.lightGen();
               break;

           case 3:
               GenerationFunctions.heavyGen();
               break;
           default:
               break;
       }


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

<p>}</p>

<p>Can anybody tell me how to code this properly?</p>

<p>Thanks</p>
