C# Variable Getters / Setters
<p>I'm trying to create a simple way for external programs to get/set variables within my class. What I have is a class with several variable such as this:</p>

<pre><code>class myClass
{
    public int one
    {
        get{ /* get code here */ }
        set{ /* set code here */ }
    }
}
</code></pre>

<p>Rather than just variable 'one' I have close to 100 variables. All are set up the same way with get and set code. What I would like to have is a simple way to get and set the variables. Example: Instead of having to do this:</p>

<pre><code>myClass c = new myClass();
c.one = 5;
</code></pre>

<p>I would like to find a way to do something similar to this:</p>

<pre><code>myClass c = new myClass();
c.setVariable("variableName", value);
</code></pre>

<p>It would be ideal to have the "variableName" text come from an enum list so that they could be referenced like:</p>

<pre><code>c.setVariable(enumName.varName, value);
</code></pre>

<p>I am unsure how to go about this or if it is even possible. As I said i have close to 100 variables which need their own get/set code, but I'd prefer to have only one public get function and one public set function for various reasons.</p>

<p>As I don't think reflection is very efficient, I'd like to avoid it if at all possible.</p>

<p>I've seen other code in C# where something like this is used:</p>

<pre><code>this["variableName"] = value;
</code></pre>

<p>However I can't seem to find a way to make this work either...</p>
