title: How to retrieve ConfigurationElement using key (array key access) in ConfigurationCollection?
body: <p>I need to do something like this on my custom configuration section:</p>
  
  <pre><code>ConfigurationManager.ConnectionStrings["mongodb"]
  </code></pre>
  
  <p>The string "mongodb" above is the key that I am using to access de element of type System.Configuration.ConnectionStringSettings. I wish to do the same with my custom collection:</p>
  
  <pre><code>[ConfigurationCollection(typeof(Question))]
  public class QuestionCollection : ConfigurationElementCollection
  {   
  
      public override bool IsReadOnly()
      {
          return false;
      }
  
      protected override ConfigurationElement CreateNewElement()
      {
          return new Question();
      }
  
      protected override object GetElementKey(ConfigurationElement element)
      {
          return ((Question)element).id;
      }
  
      //Is here?
      public Question this[int idx]
      {
          get {
              return (Question)BaseGet(idx);
          }
  
          set
          {
              if (BaseGet(idx) != null)
                  BaseRemoveAt(idx);
  
              BaseAdd(idx, value);
          }
      }
  
  }
  </code></pre>
  
  <p>I was wondering that method commented above is the way to get what I want... But I don't know how.... The type of key I want use to access is integer.</p>
  
  <p>Supposing I have the following configuration:</p>
  
  <pre><code>    &lt;securityQuestions&gt;
      &lt;questions&gt;
        &lt;add id="3" value="What is your name?" default="true"/&gt;
        &lt;add id="4" value="What is your age?"/&gt;
      &lt;/questions&gt;
  &lt;/securityQuestions&gt;
  </code></pre>
  
  <p>How can I access the first element (id=3) with ...Section.Questions[3] (3 is not the position, but the key)?  </p>