title: Get the name of parameters from a calling method
body: <p>I have a project using C# .NET 2.0 (cannot use a higher version). I would like to get the name of the parameters of a method in a method called by the first one. If I call a method from the MyMethodsClass, I want to receive a string indicating which parameter is not valid, following some conditions indicated in the isValid method from the MyCheckClass class.</p>
  
  <p>With the following code, I get a string that returns "Please check the 5 parameter" in case I would call the myMehtod(5,1,1). But I would like to obtain, "Please check the a parameter".</p>
  
  <p>How could I do that?
  Thank you!</p>
  
  <pre><code>public MyMethodsClass {
  
      public string myMethod (int a, int b, int c) {
  
          return MyCheckClass.isValid(a,b,c);
      }
  
      public string myMethod2 (int d, int e) {
          return MyCheckClass.isValid(d,e);
      }
  
  }
  
  
  //Other file
  public class MyCheckClass {
  
      public static string isValid (params object[] parameters) {
  
              StringBuilder result= new StringBuilder();          
              for (int i = 0; i &lt; parameters.Length; i++)
              {
                  object p = parameters[i];
                  //Some checks...
                  if (p == null || p.Equals("") || p != 5)
                  {                    
                      result.Append("Please check the " + p + " parameter");
                  }
              }
              return result.toString();               
      }
  }
  </code></pre>