title: Anonymous types VS Local variables, When should one be used?
body: <p>I am not sure when I should use <em>anonymous types</em> instead of <em>local variables</em> in C#.</p>
  
  <p>I have:</p>
  
  <pre><code>string  fullMessage // This is the full message including sender and recipient names
  
  string sender = GetMessagePart(fullMessage, "from");
  string recipient = GetMessagePart(fullMessage, "to");
  
  //do some stuff and deliver the message
  </code></pre>
  
  <p>Should I use:</p>
  
  <pre><code>var msg = new { 
  sender = GetMessagePart(fullMessage, "from")
  recipient = GetMessagePart(fullMessage, "to")
  };
  </code></pre>
  
  <p>Instead?</p>