title: Checking if multiple string parameter values are empty in a method
body: <p>If I have a C# method similar to</p>
  
  <pre><code>public void MyMethod(object myObject, string s1, string s2, string s3, ...)
  { ... }
  </code></pre>
  
  <p>and I needed to do a value check on the strings (if !string.IsNullOrEmpty(<em>var</em>)), instead of going through each variable, because there are quite a few of if checks, is there a more generic way I could accomplish this?</p>
  
  <p>I was hoping to use ParameterInfo until I found you could not retrieve the Value of the parameter. My parameters will either be "" or have a value of a number (as a string) or true/false (as a string) -- these are going into a web.config, hence the string. The name of the method variable is the parameter name going into the web.config. I'm preventing writing of parameters that have null/empty values into the web.config, hence the IsNullOrEmpty check.</p>
  
  <p>Right now what I have for each method parameter is below, just to give you an idea of format.</p>
  
  <pre><code>string name, value;
  if (!string.IsNullOrEmpty(s1))
  {
   name = "s1";
   value = s1;
   /* do stuff */
  }
  if (!string.IsNullOrEmpty(s2))
  {
   name = "s2";
   value = s2;
   /* do stuff */
  }
  /* too many of these */
  </code></pre>