You can't. An optional parameter's default value is stored in IL as a constant. "The current directory" is not a constant, so it can't be used as a default value.
The closest you can easily come is to make the optional value null, and use the current directory in that case:
// Use the C# syntax for this, rather than specifying the attribute explicitly
public void GenerateReport(int ReportId, string saveToFolderPath = null)
{
saveToFolderPath == saveToFolderPath ?? Directory.GetCurrentDirectory();
...
}
I don't think there's anything you can do explicitly using attributes that you can't do using the C# syntax for optional parameters, so you might as well be idiomatic about it.
That does mean that anyone explicitly passing null
will get the same behaviour, however - which may not be what you want. Another alternative is to use two overloads as Servy has shown.