I am wondering how do I get the key name from Model Sate or Model State Dictionary.
When you add a error to the dictionary
modelStateDictionary.AddModelError("key","errorMessage");
you have to specify a key.
I want to get the key name.
foreach (ModelState modelState in modelStateDictionary.Values)
{
}
I did the above but that only contains the error message I want to know what the key of that was. I only can find to get all keys that gets stored in a list of strings. I want to get it out each time I go through the foreach loop. So can I not get a key name by index or something?
You can also enumerate the .Keys property