I was trying to figure out how to run a block of code if the value of a variable is not equal to some value in an ignore list I've set up.
List<Variance> variancesList = new List<Variance>();
PropertyInfo[] fieldList = saveModel.GetType().GetProperties();
foreach (PropertyInfo field in fieldList)
{
if (!placeholder)
{
Variance variance = new Variance();
variance.property = field.Name;
variance.saveValue = field.GetValue(saveModel, null);
variance.loadValue = field.GetValue(loadModel, null);
if (!Equals(variance.saveValue, variance.loadValue))
variancesList.Add(variance);
}
}
I'd like to replace placeholder with a check against a list, where if a property name is in the list, it should skip over the comparison.
Any ideas? Thanks for the assistance.
if( !IgnoreList.Contains(value) ) { ... }