title: How do you use a string as an Index?
body: <p>Morning.</p>
  
  <p>Issue:<br>I have a class called Reports.  Two constructors.  One allows no parameters, the other a string array.  The string array is supposed to be the reports they'd like to display.  What I'd like to do is the following:</p>
  
  <pre><code>string strSQL = this.Queries[strReportName];
  </code></pre>
  
  <p>I have a feeling it's possible because in the dataGridView I'm using, I get the column index by:</p>
  
  <pre><code>int nColumnIndex = dgvParts.Columns[strColumnName].Index;
  </code></pre>
  
  <p>Both of those examples use a string to determine what value in the array they retrieve, but I'm not sure how to do this.  Can anyone give me some help?  Any and all help is appreciated.</p>
  
  <p>To the editors and mods:  Yes, the reports part loosely ties to the other post I have about dynamically loading DLLs but I'd like to keep the other open still.  My boss and I decided for the short term, we'll just have a single DLL and everything is hard coded, but in the long run we want to dynamically drop in DLLs as reports, so please don't tag this as a duplicate.  I plan this weekend to try and implement the methods given to me in the other thread.  Thanks.</p>
  
  <p><b>Edit - Part 2 of the question</b>:  Ok, here's my class as it is right now:</p>
  
  <pre><code>public class Queries
  {
    #region Report Queries
      #region Missing Code
        string strMissingCode = "SELECT * FROM PARTS WHERE CODE IS NULL OR CODE = ''";
      #endregion
    #endregion
  }
  </code></pre>
  
  <p>I'd like to change it to something like this:</p>
  
  <pre><code>public class Queries : Dictionary&lt;string, string&gt;
  {
  }
  </code></pre>
  
  <p>But I don't want them to have to use a constructor to instantiate it.  I want static of sorts so I can run code like this:</p>
  
  <pre><code>class Reports
  {
    private List&lt;ReportRecord&gt; _lstRecrods = new List&lt;ReportRecord&gt;();
    public List&lt;ReportRecord&gt; Records { get { return _lstRecords; } }
  
    public Reports(string[] strDisplayedReports)
    {
      foreach (string strReportTitle in strDisplayedReports)
      {
        this.BuildReportList(strReportTitle);
      }
    }
  
    private void BuildReportList(string strReportTitle)
    {
      using (DataSet ds = Database.GetDataSet(Queries[strReportTitle]))
      {
        ...
      }
    }
  }
  </code></pre>
  
  <p>How do I make it static of sorts to where I don't have to instantiate Queries?  Thanks guys and gals.</p>