How can I tell the developer of my frontend that the path parameter is a folder?
I'm going to define an interface in my application that plugins can use to provide custom "export" capabilities. It will look something like this:
public interface IFooExporter
{
void ExportFoo(Foo foo, string path);
}
However, I need the writers to know (explicitly, not just in the documentation) that the "path" is a folder, not a filename. It is their responsibility to create the files as part of the export process.
What's the best way to enforce this path is the folder, not the filename? My best guess right now is to use DirectoryInfo instead of a string:
public interface IFooExporter
{
void ExportFoo(Foo foo, DirectoryInfo folder);
}
Is this a good solution, or are there any bugs I am not aware of with missing DirectoryInfo instances?
0
source to share