Reputation: 2083
I am creating a custom action filter in a MVC web project. My custom action filter is as follows:
public class RequestLogFilterActionAttribute : ActionFilterAttribute, IActionFilter
{
void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)
{
//Code...
}
}
How come I don't have to implement the OnActionExecuted method?
void IActionFilter.OnActionExecuted(ActionExecutedContext filterContext)
{
}
Normally, you have to implement all methods in an interface. I don't get any build errors when building my project.
Upvotes: 1
Views: 722
Reputation: 55339
How come I don't have to implement the OnActionExecuted method?
Because the base class, ActionFilterAttribute
, has a matching OnActionExecuted
method.
When you implement an interface, inherited members can be used to satisfy the interface.
Upvotes: 2