BrokenRulesCollection order

BrokenRulesCollection order

Old forum URL:

j055 posted on Thursday, July 08, 2010


I noticed that when I loop through the BrokenRulesCollection the order appears to be somewhat random. e.g.

if (!model.IsValid)
    foreach (BrokenRule brokenRule in model.BrokenRulesCollection)
        ModelState.AddModelError(brokenRule.Property, brokenRule.Description);
    return View(model);

 Is the order something I can determine in the business class?


RockfordLhotka replied on Thursday, July 08, 2010

No, the order is indeterminate. However, you can always use a LINQ query to sort the list as you see fit.

Copyright (c) Marimer LLC