Replace Getter / Setter property with reflection or similar (without third-party libraries) in C #

I have a property contained in a class like

public class Greeter {
   private Hashtable _data;
   public string HelloPhrase { get; set; }

   public Greeter(data) {
      _data = data;
   }
}

I would like to add an attribute of the HelloPhrase property, for example

[MyCustomAttribute("Hello_Phrase")]
public string SayHello { get; set; }

Thus, during the constructor, I can reflect the properties in the class (Greeter), where MyCustomAttribute is defined and set the Get / Set methods of the property to an anonymous method / delegate.

  public Greeter(data) {
      _data = data;
      ConfigureProperties();
   }

I managed to get PropertyInfo from the class, but this only provides GetSetMethod (http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.getsetmethod.aspx) and the corresponding GetGetMethod method.

I read some questions here and on the Internet, but cannot find an answer that does not use any Aspects library.

- Get/Set ?

x =>_data[keyDefinedByAttribute]; 
+5
1

. getters seters. :

  • AOP

- , IMO , . - ( , .)

SetGetMethod SetSetMethod.

+4

All Articles