I have a large C# Dictionary of string keys and boolean values. Background on the reason for it is this: my program builds up a bunch of the same objects from two different sources, and then compares all the properties to see if there are any disparates. But I want to ignore the differences where I know one source hasn't exposed that property for comparison, so I have this array that lists the properties that are actually 'gathered'.
Then when filtering the differences before user display, I ask if(!gathered[prop])
and remove it in that case. It would throw an exception if I hadn't defined a case for the property, and I don't want to ignore that as it may just mean I neglected to specify if it was or wasn't gathered.
public Dictionary<string, bool> TPORGatheredData = new Dictionary<string,bool>()
{
// Represents fields that are actually retrieved from TP data
{ "Reference", true },
{ "Title", true },
{ "Status", true },
{ "Status.State", true },
{ "OriginatorName", true },
{ "InvestigatorName", true },
{ "ManagerName", true },
{ "ObservedOn", true },
{ "RaisedOn", true },
{ "ClosedOn", true },
{ "Project", true },
{ "VariantObservedOn", true },
{ "SoftwareVersionObserved", true },
{ "AreaObservedOn", true },
{ "StageObservedOn", true },
{ "VariantAppliedTo", true },
{ "AreaAppliedTo", true },
{ "FaultClassification", true },
{ "Type", true },
{ "SecurityClassification", true },
{ "CommercialClassification", true },
{ "SecurityGroup", true },
{ "SafetyRelated", true },
{ "Description", false },
{ "Recommendations", true },
{ "Recommendations.PointNumber", true },
{ "Recommendations.Id", true },
{ "Recommendations.Type", true },
{ "Recommendations.RecommendationText", true },
{ "ClosureText", true },
};
The problem with this is that the value of false
is quite significant. How could I differentiate the false
from the true
here?
Two options I can think of:
I could tab align all the values but this looks ugly as the farthest extent they need to go for alignment is a bit too far to easily see which value is for which key.
assume if there's no key then the value is true (although that depends on the context making this a suitable option, and as it stands in my case not having the value may be an indicator of a field that needs checking to see if it is or isn't handled).