:::: MENU ::::

Tuesday, October 28, 2008

Do you know the C# Anonymous Object? If you don’t know this concept, I can suggest  this url to you http://msdn.microsoft.com/en-us/library/bb397696.aspx

In the previous Tips , we introduced how do we use the interface in LINQ. We did not use the new key word “var” on purpose. In this tips , we will use the var to show how powerful and cool the anonymous object could be.

We have one interface and one method to populate a list of the data for us.

   1:  public interface IName
   2:      {
   3:          string FirstName{get;set;}
   4:          string LastName { get; set; }
   5:          string Prefix { get; set; }
   6:      }
   7:   
   8:      public class Name : IName
   9:      {
  10:          #region IName Members
  11:   
  12:          public string FirstName
  13:          {
  14:              get;
  15:              set;
  16:          }
  17:   
  18:          public string LastName
  19:          {
  20:              get;
  21:              set;
  22:          }
  23:   
  24:          public string Prefix
  25:          {
  26:              get;
  27:              set;
  28:          }
  29:   
  30: