0

The title pretty much says it all, but what I would like to know is whether there is an advantage to using one or the other?

For example:

public void MyMethod(params string[] list) { }

public void MyMethod(string[] list = new string[] { }) { }

How are those different?

Felix Poitras
  • 288
  • 2
  • 9
  • The first one allows you to call the method with multiple string parameters while the second one requires exactly one array of strings. So `MyMethod("one", "two", "three")` vs `MyMethod(new [] { "one", "two", "three" })` – juharr Aug 11 '17 at 16:44
  • That makes a lot of sense. Thank you. – Felix Poitras Aug 11 '17 at 16:50

0 Answers0