is it possible to create a public method that generates an unknown number of private instance variables in C#?
<p>Basically I am trying to implement my own array class, and I was wondering if creating a public method that generates an unknown number of private instance variables was the way to go? Something like:</p>

<pre><code>public class myArray {
    public myArray(int length) {
        for(int i = 0; i &lt; length; i++) {
            int component+i;
        }
    }
    int component(int indexOfComponent) {
        return component+indexOfComponent; 
    }
}
</code></pre>

<p>I know the the line of code inside that for loop makes no sense. But I just thought I would illustrate what I was talking about. What would result from creating an object from the myArray class with 3 as the constructor parameter would be:</p>

<pre><code>public class myArray {
    private int component1;
    private int component2;
    private int component3;

    public myArray(int length) {
        for(int i = 0; i &lt; length; i++) {
            int component+i;
        }
    int component(int indexOfComponent) {
            return component+indexOfComponent; 
        }
    }
}
</code></pre>

<p>And I know those variables would only exist inside the for loop, but that is the best way I can exemplify what I am trying to do. Is this even the way to go if I am trying to implement my own array class?
Also; there's one more thing about this that I think may deserve a separate question but it's the whole problem with naming variables dynamically with a for loop.</p>
