title: How to check if a certain row exists in a c# dictionary depending on declared types
body: <p>Let's say that I've created a list that has a dictionary inside its members.</p>
  
  <pre><code>    List&lt;FieldValues&gt; fieldValues = new List&lt;FieldValues&gt;()
  {
      new FieldValues(tableFields[0]) {
          dictionary = new Dictionary&lt;int, string&gt;()
          {
              {0, "" },
              {1, "" }
          }
  
      },
      new FieldValues(tableFields[1]) {
          dictionary = new Dictionary&lt;int, string&gt;()
          {
              {0, "x" },
              {1, "x" }
          }
  
      },
      new FieldValues(tableFields[2]) {
          dictionary = new Dictionary&lt;int, string&gt;()
          {
              {0, "x" },
              {1, "x" }
          }
  
      },
      new FieldValues(tableFields[3])  {
          dictionary = new Dictionary&lt;int, string&gt;()
          {
              {0, "Car" },
              {1, "Travel" }
          }
  
      },
  };
  </code></pre>
  
  <p>Note that I created classes <strong>FieldValues:Fields</strong> like this:</p>
  
  <pre><code>enum FieldType
  {
      Boolean,
      Integer,
      String
  }
  
  class Fields
  {
      public FieldType type { get; set; }
      public string name { get; set; }
  
      //declar fields(columns) name and types (types should be as in mysql syntax)
      public string GetFieldDeclaration()
      {
          switch (type)
          {
              case FieldType.Boolean:
                  return name + " tinyint(1)";
              case FieldType.Integer:
                  return name + " int";
              case FieldType.String:
                  return name + " varchar(2048)";
              default:
                  return string.Empty;
          }
      }
  }
  
  class FieldValues:Fields
  {
      public Dictionary&lt;int, string&gt; dictionary { get; set; }
  
      //in order to add a new field value of the respected field
      public FieldValues(Fields field)
      {
          type = field.type;
          name = field.name;
          dictionary = new Dictionary&lt;int, string&gt;();
      }
  
  
      public void AddToDictionary(int row, string cellValue)                             
      {
  
          if (dictionary.ContainsKey(row))
          {
              dictionary[row] = cellValue; 
          }
          else
          {
              dictionary.Add(row, cellValue); //else adaug randul la tabela
          }
      }
  
      public string GetRowValue(int row)
      {
          if (dictionary.ContainsKey(row))
          {
              if()
          }
          return string.Empty;
      }
  
  
  }
  </code></pre>
  
  <p>All this I will use to insert an excel spreadsheet values into mysql database like this: </p>
  
  <pre><code>string createQuery2 = createQuery + "\n INSERT INTO `poi_specs_mgu_ece_1.6` (";
  
          for (var i = 0; i &lt; tableFields.Count; i++)
          {
              createQuery2 += "\n\t" + tableFields[i].GetFieldDeclaration() + (i == tableFields.Count - 1 ? string.Empty : ",");
          }
          createQuery2 += ")\n VALUES ( ";
  
  
          for (var i = 0; i &lt; fieldValues.Count; i++)
          {
  
              createQuery2 += "\n\t" + fieldValues[i].dictionary[0] + fieldValues[i].dictionary[1];
          }
          createQuery2 += " \n);";
  </code></pre>
  
  <p>and I want to create a method inside FieldValues class, GetRowValue(), that checks if a certain row is present in dictionary, depending on this, i will now which type of values should be inserted and it seems i am stuck on this.</p>
  
  <p>Any help would be appreciated. Thank you!</p>