title: Get value from array if not out of bounds
body: <p>I'm looking for the most elegant solution to get values from an <code>object[]</code> when the requested index is not out of bounds.</p>
  
  <p>My current solution is as follows:</p>
  
  <pre><code>    public object GetNamedParametersFrom(GenericObject genericObject)
      {
          string nameFromListOne = String.Empty;
          string nameFromListTwo = String.Empty;
  
          for (int i = 0; i &lt; genericObject.ListOfThings.Count; i++)
          {
              switch (i)
              {
                  case 0:
                      nameFromListOne = genericObject.ListOfThings[i].Name;
                      break;
                  case 1:
                      nameFromListTwo = genericObject.ListOfThings[i].Name;
                      break;
              }
          }
  
          return new {
             nameFromListOne,
             nameFromListTwo
          }
      }
  </code></pre>