title: Is it possible to have dictionary where keys are of type bool?
body: <p>Something like this:</p>
  
  <pre><code>string defectGuid = null;
  
  var dictionary = new Dictionary&lt;bool,string&gt; {
      {new ProjectDiscrepancyWrongLocation().Conditions(row), "88ff2dfb-6190-4ab6-b13b-68de1719eac2"},
      {new DestructionLeakiness().Conditions(row), "af018ee7-7974-45f8-a508-18359cde4108"},
      {new CoatingInsulationDefect().Conditions(row), "232b2b2e-abc0-46b2-8b8c-45fede83ad83"},
      {new CathodicProtectionUnitUnderProtectionZone().Conditions(row), "78cb3548-0d61-4809-bf28-0590dfb52010"},
      {new CoatingPaintDefect().Conditions(row), "83e82b20-efc9-4500-8ca5-bb29631ccc61"},
      {new ProjectDiscrepancyEdgesOffset().Conditions(row), "cf9c76c3-79eb-4856-8dc6-c9c7321a3ed5"},
      {new DocumentationDiscrepancyDiscrepanciesInDocumentation().Conditions(row), "d3c793bc-5840-413a-8cae-6962772b4a88"},
      {new DestructionElementDestruction().Conditions(row), "6b8924f9-5bba-4db8-b33c-099ca17a58b9"},
      {new IndicatorDefectDamage().Conditions(row), "8F2560F3-31A0-4489-9A77-387BE9347D38"}
  };
  foreach (var item in dictionary.Where(item =&gt; item.Key)) {
      defectGuid = item.Value;
  }
  return defectGuid;
  </code></pre>
  
  <p>Where one of classes is as following:</p>
  
  <pre><code>public class DestructionLeakiness : IDefectTypeConditions {
      public bool Conditions(string[] row) {
          return Helpers.NormalizeLocalizedString(row[4]).Contains("aaaa");
      }
  }
  </code></pre>
  
  <p>The issue is there will be an error that says that key already exists.</p>
  
  <p>UPDATE:</p>
  
  <p>I've changed approach to the following:</p>
  
  <pre><code>private static string SetTypeOfDefect(string[] row)
  {
      string defectGuid = null;
  
      var list = new List&lt;Tuple&lt;bool, string&gt;&gt;()
      {
          new Tuple&lt;bool, string&gt;(new ProjectDiscrepancyWrongLocation().Conditions(row), "88ff2dfb-6190-4ab6-b13b-68de1719eac2"),
          new Tuple&lt;bool, string&gt;(new DestructionLeakiness().Conditions(row), "af018ee7-7974-45f8-a508-18359cde4108"),
          new Tuple&lt;bool, string&gt;(new CoatingInsulationDefect().Conditions(row), "232b2b2e-abc0-46b2-8b8c-45fede83ad83"),
          new Tuple&lt;bool, string&gt;(new CathodicProtectionUnitUnderProtectionZone().Conditions(row), "78cb3548-0d61-4809-bf28-0590dfb52010"),
          new Tuple&lt;bool, string&gt;(new CoatingPaintDefect().Conditions(row), "83e82b20-efc9-4500-8ca5-bb29631ccc61"),
          new Tuple&lt;bool, string&gt;(new ProjectDiscrepancyEdgesOffset().Conditions(row), "cf9c76c3-79eb-4856-8dc6-c9c7321a3ed5"),
          new Tuple&lt;bool, string&gt;(new DocumentationDiscrepancyDiscrepanciesInDocumentation().Conditions(row), "d3c793bc-5840-413a-8cae-6962772b4a88"),
          new Tuple&lt;bool, string&gt;(new DestructionElementDestruction().Conditions(row), "6b8924f9-5bba-4db8-b33c-099ca17a58b9"),
          new Tuple&lt;bool, string&gt;(new IndicatorDefectDamage().Conditions(row), "8F2560F3-31A0-4489-9A77-387BE9347D38")
      };
  
      foreach (var item in list.Where(item =&gt; item.Item1))
      {
          defectGuid = item.Item2;
      }
  
      return defectGuid;
  }
  </code></pre>