title: initialize the proprty of a class, which is of another type, by extension method and object initializers
body: <pre><code>.
  .
  List&lt;DailyEntry&gt; entries = null;
  using (SqlCeDataReader rdr = cmd.ExecuteReader())
  {
      entries = rdr.Select(r =&gt; new DailyEntry
      {
          ID = int.Parse(r["Col_ID"].ToString()),
          Amount = decimal.Parse(r["Col_Amount"].ToString()),
          Date = DateTime.Parse(r["Col_Date"].ToString()),
          Remarks = r["Col_Remarks"].ToString()
      }).ToList();
  }
  .
  .
  </code></pre>
  
  <p>extrension method <code>select</code> is</p>
  
  <pre><code> public static IEnumerable&lt;T&gt; Select&lt;T&gt;(this SqlCeDataReader reader,
                                          Func&lt;SqlCeDataReader, T&gt; projection)
   {
       while (reader.Read())
       {
           yield return projection(reader);
       }
   }
  </code></pre>
  
  <p>where <code>DailyEntry</code> class is</p>
  
  <pre><code>class DailyEntry
  {
      public int ID { get; set; }
      public DateTime Date { get;set; }
      public Site Site { get; set; }
      public decimal Amount { get; set; }
      public string Remarks { get; set; }
  }
  </code></pre>
  
  <p><code>DailyEntry</code> class has one more property of type <code>Site</code></p>
  
  <pre><code>class Site
  {
      public int SiteID { get; set; }
      public string SiteName { get; set; }
  }
  </code></pre>
  
  <p>Now I want to initialize the <code>Site</code> property of <code>DailyEntry</code> just how all other properties are set in first code snippet..</p>
  
  <p>I am not finding the way?</p>