Is there a class defined for the Action + Controller pair?
I would like to create a mapping table between the value of an enum and an action / controller (i.e. Dictionnary). Is there something already defined in MVC 2 that I could reuse or I have to create my own classes?
Here is what I would like to do:
<%= Html.ActionLink(this.Model.Mapping[MyEnum.Value].Action, this.Model.Mapping[MyEnum.Value].Controller, ... %>
If you have bett开发者_高级运维er ideas or any suggestions, please let me know.
P.S. I am using MVC 2 and .NET 3.5 (I cannot use Tuple)
You could use Pair
class. (It's been in System.Web.UI since .NET 1.0). It stores two Objects, named First & Second. (However, I've defined for my standard utility library a generic version)
精彩评论