Thursday, June 25, 2009

Automatic Implemented Properties in .NET 3.5

One of the cool feature that I like in .NET 3.5 is the automatic implementation of Properties in .NET 3.5. Here is a sample:

   1:  
   2: private string _name
   3:  
   4: public string Name
   5: {
   6:     get
   7:     {
   8:         return _name;
   9:     }
  10:     set
  11:     {
  12:         _name = value;
  13:     }
  14: }

Can be re-written as:

   1:  
   2: public string Name {get; set;}
   3:  

1 comment:

marry said...

Blogs are so informative where we get lots of information on any topic. Nice job keep it up!!
_____________________________

Biology Dissertation

 
Best viewed in Internet Explorer 8.