This is my code:
private static string AddURISlash(string remotePath)
{
if (remotePath.LastIndexOf("/") != remotePath.Length - 1)
{
remotePath += "/";
}
return remotePath;
}
But I need something like
AddURISlash("http://foo", "bar", "baz/", "qux", "etc/");
If I recall correctly, string.format is somehow like that…
String.Format("{0}.{1}.{2}.{3} at {4}", 255, 255, 255, 0, "4 p.m.");
Is there something in C# that allows me to do so?
I know I could do
private static string AddURISlash(string[] remotePath)
but that’s not the idea.
If this is something in some framework can be done and in others not please specify and how to resolve it.
Thanks in advance
You can use params, which lets you specify any amount of arguments
Note that
paramswill impact the performance of your code, so use it sparingly.