Suppose I have this method I want to call, and it's from a third-party library so I cannot change its signature:
void PrintNames(params string[] names)
I'm writing this method that needs to call PrintNames:
void MyPrintNames(string[] myNames) { // How do I call PrintNames with all the strings in myNames as the parameter? }
stringarray of any length, or you can use theparamskeyword to allow calling the method with any number of arguments (provided they're the same type)