Getting an array with the content of attributes
<p>I have a class in my code in C# where I want to get all the attributes from a nested class in an array with the size of the number of parameters and the content of all of them in an array of objects. Like these:</p>

<pre><code>class MyClass {
 class Parameters {
  public const string A = "A";
  public const string B = "B";
  public const string C = "C";
  public const string D = "D";
  public const string E = "E";
  public const string F = "F";
 }    

 public object[] getAllParameters() {
    object[] array = new object[6];
    array[0] = Parameters.A;
    array[1] = Parameters.B;
    array[2] = Parameters.C;
    array[3] = Parameters.D;
    array[4] = Parameters.E;
    array[5] = Parameters.F;
}       
//more methods and code
</code></pre>

<p>}</p>

<p>But if I want to add for example, <code>G</code> and <code>H</code> parameters, I would have to update the size of the method <code>getAllParameters</code>, the initialization and more stuff in other parts of the code.</p>

<p>Could I do this "<code>getAllParameters</code>" method more generic, without taking account of the explicit parameters? With reflection maybe?</p>
