Reputation: 1083
I have text files with one source and two destination path..I'm sending those to one function called Copy(source,destination).... for one path it creates(destination).I want to send the other parameter(other destination path)...How can i achieve this?
Upvotes: 1
Views: 55
Reputation: 49965
You could create an overload of the function to take multiple destination paths, and all it does it iterate all the destination paths and call the original Copy
function:
public void Copy(string sourcePath, params string[] destinationPaths)
{
foreach (string destPath in destinationPaths)
{
Copy(sourcePath, destPath);
}
}
You can call this with:
Copy(sourcePath, destinationPath1 [, destinationPath 2, destinationPath 3...]);
or you could just call Copy(source, dest)
twice.
Upvotes: 1