It depends on preference and use.
You can take the listed values โโin a strongly typed way:
public void SomeFunction(MyEnum someValue) { }
or
TempData[MyEnum.Message]
With constant strings you cannot.
You also have a built-in way of listing the values โโin an enumeration.
There is a third option that you did not present, and this means that your โconstantsโ are in your configuration settings (App.Config). This will allow you to customize them after compilation. You may not need it now, but you can in the future, so itโs worth considering.
One of them might be better for globalization. I am not sure, since I have never globalized the application. I believe this works in satellite assemblies.
Basically, it comes down to what TempData is, and how you intend to use it.
Merlyn morgan-graham
source share