I have an OnMethodBoundaryAspect attribute (PostSharp), I want to be able to use expression from attribute constructor that gets uses the methods parameters
Lets say something like this :
[MyAttribute(p => p.SomeProperty)]
public void DoSomething(Parameter parameter)
{
....
}
p is type Parameter
Is it possible?
Thanks
Using expression trees in attribute constructors is not possible.
Depending on the problem you are trying to solve there may be ways that would achieve what you are trying to solve - e.g. you can use PostSharp to analyze the method body and apply aspects dynamically based on that information.