title: Setting value of an item in a DataRow does not work
body: <p>I am trying to convert all DateTime values in a DataTable to strings. Here is the method I use:</p>
  
  <pre><code>private static void ConvertDateTimesToStrings(DataTable dataTable)
  {
      if (dataTable == null)
      {
          return;
      }
  
      for (int rowIndex = 0; rowIndex &lt; dataTable.Rows.Count; rowIndex++ )
      {
          for (int i = 0; i &lt; dataTable.Columns.Count; i++)
          {
              DateTime dateTime;
              try
              {
                  dateTime = (DateTime)dataTable.Rows[rowIndex][i];
              }
              catch (InvalidCastException)
              {
                  continue;
              }
              dataTable.Rows[rowIndex][i] = dateTime.ToString("dd.MM.yyyy hh:mm:ss");
          }
      }
  }
  </code></pre>
  
  <p>After this line works:</p>
  
  <pre><code>dataTable.Rows[rowIndex][i] = dateTime.ToString("dd.MM.yyyy hh:mm:ss");
  </code></pre>
  
  <p>I check the value of dataTable.Rows[rowIndex][i] and see it is still a DateTime, not a string. Why does this happen and how can I solve this?</p>
  
  <p>Edit: I am trying to do this because I am fighting an api and unfortunately I do not have the choice of which component to use.</p>