I have an enum:
public enum Navigation
{
Top = 0,
Left = 2,
Footer = 3
}
And i have a controller action:
public ActionResult Quotes()
{
return View();
}
I would like to be able to decorate my action as follow:
[Navigation.Top]
public ActionResult Quotes()
{
return View();
}
Any idea how this could be accomplished, i will probably have to create a custom attribute, but how do i incorporate this enum into it?
One approach:
If You do want to use enums, I’m afraid You won’t be able to use them as attributes. But You can pass it to attribute as an argument. Something like this: