title: How do I simplify this verbose ADO.NET Database Code
body: <p>Trivial question - I'm inexperienced with <code>C#</code>.</p>
  
  <p>I have the following code to call a multi-parameter SQL-Server stored procedure.
  It works and it is nice and explicit i.e. easy to read what is happening but it's very verbose.</p>
  
  <p>Is there a standard shorter version of the following?</p>
  
  <pre><code>using(var conn = new SqlConnection(this.connString))
  using(var comm = new SqlCommand(DatabaseLayer.procSendEmail,conn))
  {
    comm.CommandType = CommandType.StoredProcedure;
  
    SqlParameter pmIsTemplate = new SqlParameter("@IsTemplate",SqlDbType.TinyInt);
    SqlParameter pmDateInsertKey = new SqlParameter("@DateInsertKey",SqlDbType.Int);
    SqlParameter pmEmailTO = new SqlParameter("@EmailTO",SqlDbType.NVarChar,1000);
    SqlParameter pmEmailBody = new SqlParameter("@EmailBody",SqlDbType.NVarChar,-1);
    SqlParameter pmEmailImportance = new SqlParameter("@EmailImportance",SqlDbType.TinyInt);
    SqlParameter pmEmailSubject = new SqlParameter("@EmailSubject",SqlDbType.NVarChar,1000);
    SqlParameter pmSuccess = new SqlParameter("@Success",SqlDbType.Bit);
  
    pmIsTemplate.Direction        = ParameterDirection.Input;
    pmDateInsertKey.Direction     = ParameterDirection.Input;
    pmEmailTO.Direction           = ParameterDirection.Input;
    pmEmailBody.Direction         = ParameterDirection.Input;
    pmEmailImportance.Direction   = ParameterDirection.Input;
    pmEmailSubject.Direction      = ParameterDirection.Input;
    pmSuccess.Direction           = ParameterDirection.Output;
  
    comm.Parameters.Add(pmIsTemplate);
    comm.Parameters.Add(pmDateInsertKey);
    comm.Parameters.Add(pmEmailTO);
    comm.Parameters.Add(pmEmailBody);
    comm.Parameters.Add(pmEmailImportance);
    comm.Parameters.Add(pmEmailSubject);
    comm.Parameters.Add(pmSuccess);
  
    ...
    ...
  </code></pre>