title: Architecturally speaking, how should I replace an extremely large switch statement with something more manageable?
body: <p><strong>EDIT 1:</strong> Forgot to add the nested property curve ball.</p>
  
  <p><strong>UPDATE:</strong> I have chosen @mtazva's answer as that was the preferred solution for my specific case.  In retrospect, I asked a general question with a very specific example and I believe that ended up confusing everyone (or maybe just me) as to what the question was exactly.  I do believe the general question has been answered as well (see the Strategy pattern answers and links).  Thanks everyone!</p>
  
  <p>Large switch statements obviously <a href="http://c2.com/cgi/wiki?SwitchStatementsSmell" rel="nofollow noreferrer">smell</a> and I have seen some links on how you could do this with a <a href="http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/" rel="nofollow noreferrer">dictionary that maps to functions</a>.  But I'm wondering if there is a better (or smarter way) to do this?  In a way, this is a question I've always sort of had rolling around in the back of my head but never really had a good solution to.</p>
  
  <p>This question stemmed from another question I asked earlier: <a href="https://stackoverflow.com/questions/7396315/how-to-select-all-the-values-of-an-objects-property-on-a-list-of-typed-objects-i">How to select all the values of an object&#39;s property on a list of typed objects in .Net with C#</a></p>
  
  <p>Here is an example class I'm working with (from an external source):</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class NestedGameInfoObject
  {
      public string NestedName { get; set; }
      public int NestedIntValue { get; set; }
      public decimal NestedDecimalValue { get; set; }
  }
  
  public class GameInfo
  {
      public int UserId { get; set; }
      public int MatchesWon { get; set; }
      public long BulletsFired { get; set; }
      public string LastLevelVisited { get; set; }
      public NestedGameInfoObject SuperCoolNestedGameInfo { get; set; }
      // thousands more of these
  }
  </code></pre>
  
  <p>Unfortunately, this is coming from an external source... imagine a HUGE data dump from Grand Theft Auto or something.</p>
  
  <p>And I want to get just a small cross section of a list of these objects.  Imagine we want to be able to compare you with a bunch of your friends' game info objects.  An individual result for one user would look like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class MyResult
  {
      public int UserId { get; set; }  // user id from above object
      public string ResultValue { get; set; }  // one of the value fields from above with .ToString() executed on it
  }
  </code></pre>
  
  <p>And an example of what I want to replace with something more manageable (believe me, I DON'T want to be maintaining this monster switch statement):</p>
  
  <pre class="lang-cs prettyprint-override"><code>const int MATCHES_WON = 1;
  const int BULLETS_FIRED = 2;
  const int NESTED_INT = 3;
  
  public static List&lt;MyResult&gt; GetMyResult(GameInfo[] gameInfos, int input)
  {
    var output = new List&lt;MyResult&gt;();
  
    switch(input)
    {
      case MATCHES_WON:
          output = gameInfos.Select(x =&gt; new MyResult()
           {
              UserId = x.UserId, 
              ResultValue = x.MatchesWon.ToString()
           }).ToList&lt;MyResult&gt;();
        break;
  
      case BULLETS_FIRED:
          output = gameInfos.Select(x =&gt; new MyResult()
           {
              UserId = x.UserId, 
              ResultValue = x.BulletsFired.ToString()
           }).ToList&lt;MyResult&gt;();
        break;
  
      case NESTED_INT:
          output = gameInfos.Select(x =&gt; new MyResult()
           {
              UserId = x.UserId, 
              ResultValue = x.SuperCoolNestedGameInfo.NestedIntValue.ToString()
           }).ToList&lt;MyResult&gt;();
        break;
  
      // ad nauseum
    }
  
    return output;
  }
  </code></pre>
  
  <p>So the question is are there any reasonable ways to manage this beast?  What I'd really like is a dynamic way to get this info in case that initial object changes (more game info properties are added, for instance).  Is there a better way to architect this so it's less clumsy?</p>