Thursday, May 10, 2012

the manner in which getsetters reflect

I made a class which only had 20 getsetters and nothing else beyond a constructor. Then I used this means to determine the methods by way of reflection. type.GetMethods() gave me 44 methods! Four of them were:

  1. ToString
  2. Equals
  3. GetHashCode
  4. GetType

 
 

Remaining were the forty methods for twenty getsetters. Each getsetter had two methods upon reflection. A getsetter for Foo would be reflected like so:

  1. get_Foo
  2. set_Foo

 
 

The manner in which getsetters reflect is another thing I picked up from C# 4.0 in a Nutshell!

No comments:

Post a Comment