Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of compound iteration when performing validation against loosely typed data
public List<string> Validate(IDictionary<string, object> data, List<Field> mandatoryFields)
{
var errors = new List<string>();
foreach (var field in mandatoryFields)
{
if (!data.Keys.Contains(field.Identifier))
{
errors.add(String.Format("The {0} field is required", field.Identifier);
}
}
return errors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.