title: foreach over anonymous types
body: <pre><code>using System;
  using System.Linq;
  using System.Text;
  using System.Net;
  using System.IO;
  
  namespace LearningJustCode
  {
      class Program
      {
          static void Main(string[] args)
          {
              Update();
          }
  
          static void Update()
          {
              var quote1 = new { Stock = "DELL", Quote = GetQuote("DELL") };
              var quote2 = new { Stock = "MSFT", Quote = GetQuote("MSFT") };
              var quote3 = new { Stock = "GOOG", Quote = GetQuote("GOOG") };
  
              var quotes = new object[] { quote1, quote2, quote3 };
  
              foreach (var item in quotes)
              {
                  Console.WriteLine(item.Stock);
                  Console.WriteLine(item.Quote.ToString());
              }
          Console.ReadKey();
  
          }
  
          static string GetQuote(string stock)
          {
              try
              {
                  return InnerGetQuote(stock);
              }
              catch (Exception ex)
              {
  
                  Console.WriteLine(ex.Message);
                  return "N/A";
              }
          }
  
          static string InnerGetQuote(string stock)
          {
              string url = @"http://www.webservicex.net/stockquote.asmx/GetQuote?symbol={0}";
              var request = HttpWebRequest.Create(string.Format(url, stock));
  
              using (var response = request.GetResponse())
              {
                  using (var reader = new StreamReader(response.GetResponseStream(), Encoding.ASCII))
                  {
                      return reader.ReadToEnd();
                  }
              }
  
  
          }
      }
  }
  </code></pre>
  
  <p>I am getting an squiggley over item;Variable 'item' is only assigned to. This code has been slightly modified from Paul Kimmel's book C# Unleashed by Sams. </p>