I’m aware of writing custom attributes that decorate a method and get evaluated before the method executes, but is there a way to modify it so the attribute gets evaluated after the method gets executed?
Theoretically (in pseudo-code):
public void MyMethod()
{
Console.WriteLine("Hello World");
}
[AttributeToExecuteAfter]
Am I misusing the concept of an attribute? If there’s a technical reason this shouldn’t be possible, what is it?
Are you referring to ActionFilters in .net MVC?
If you are, you can override the OnActionExecuted method by extending the abstract ActionFilterAttribute class. These only apply to mvc action methods though.