title: PropertyInfo SetValue Type Conversion
body: <p>I have a problem with method UniversalConverter. Row received from database should be transferred in to entity. So row[pi.Name] must be converted in to entity type. How to perform this?</p>
  
  <pre><code>public void GetRequestSummary(string UserName, string Password)
      {
          List&lt;EducationRequest&gt; requestSummary = new List&lt;EducationRequest&gt;();
          OracleCommand command = new OracleCommand();
  
          AddParameter(command, _usernamePN, DbType.String, UserName);
          AddParameter(command, _passwordPN, DbType.String, Password);
          AddOracleCursor(command, _curPN, OracleType.Cursor, ParameterDirection.Output); 
  
          command.CommandType = CommandType.StoredProcedure;
  
          DataSet personaSet =
              FillDataset(command, _GetRequestSummaryCmd);
  
          DataTable personaTable =
              personaSet.Tables[0];
  
          var request = new EducationRequestSummary();
          foreach (DataRow row in personaTable.Rows)
          {
              UniversalConverter(request, row);
          }
  
          //any implementation
  
      }
  
  public void UniversalConverter&lt;T&gt;(T entity, DataRow row)
      {
  
          foreach (var pi in typeof(T).GetProperties())
          {
              pi.SetValue(entity, row[pi.Name], null);
          }
      }
  </code></pre>