How can I reach the holder of the attribute?
I want to define an attribute which is like the WebMethod, but it can
have a string parameter which may store a different method name, if
it is different as the method name bellow
[myWebMethod(differentName)]
public string Hello(string name)
{
....
}
[AttributeUsage(AttributeTargets.Method, Inherited = false,
AllowMultiple = true)]
public class myWebMethod:System.Attribute
{
public string mehodName;
public myWebMethod(string diffName)
{
methodname = diffName;
}
public myWebMethod()
{
// in this case the name is the same as the method name
methodName = ?????
}
}
How can I set the "methodName" there. What I need is something like
this:
methodName = attributeHolder.MethodName;