views:

28

answers:

1

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 better ideas or any suggestions, please let me know.

P.S. I am using MVC 2 and .NET 3.5 (I cannot use Tuple)

+1  A: 

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)

James Curran