vendredi 24 juillet 2015

get method info into attribute in C#

I want to get method info into attribute in C#.

something like this

Attribute

public class ReflectionAttribute : Attribute
    {
      public ReflectionAttribute()
      {      
                //reflection things comes here 

                // for example
                // var myMethod =  this.GetMethodInfo()
      }

    }

Class

 public  class ReflectionTest
    {

      [Reflection()]
      public string SendMessage()
      {

          return "Hello World";

      }

    }

I just want to get information about SendMessage method inside attribute when SendMessage method is invoked.

is it possible?

thank you.





Aucun commentaire:

Enregistrer un commentaire