Brandon Lewis

Brandon Lewis

  • NA
  • 527
  • 125.8k

params string[] not taking first argument

Mar 2 2008 5:17 PM
I have a method definition like this:

public void Log(Exception ex, ExceptionLevel exceptionLevel, params string[] optionalInfo)
{
   //Log the exception and such here.
}


And then if I make a method call to this method, like such:

Log(new Exception("This is a test message"), ExceptionLevel.Low, "Testing", "Exception Handling", "Operation");

The method will not get passed the very first argument, "Testing", that is passed to it and I end up with an array comprised of "Exception Handling" and "Operation", no first argument.

Has anyone else run into this issue?

Answers (3)