I was writing a class with two diffrent constructor overloads:
public class MyClass
{
public MyClass(params string[] Files)
{
}
public MyClass(string Path, params string[] Files)
{
}
}
After I wrote it, my code got me confused that how should I know that if the variable Path
is given as argument or not.
There is no error in program but I'm wondering for example if I run the following code, how to understand that Path
is given or not?
MyClass x = new Myclass("a","b","c");
it can be either
Path = "a";
Files = string[]{"b","c"};
or just
Files = string[]{"a", "b", "c"};