OK, now the
correct answer:
string fileName = string.Format(
"{0}{1}{2}{3}",
path,
System.IO.Path.DirectorySeparatorChar,
fName,
".xlsx");
Other answers does not take into account that the directory separator in the form of '\' is not portable — so I could not accept them. In particular, it won't work on Unix (yes, support of Unix is a part of CLI standard, in practice, this code can be used on Linux, Unix, MAC, etc. using Mono).
Also,
string.Format
is reportedly of better performance then a set of string concatenations (using '
+
').
Thank you for attention to these details.
—SA