I have a control flow question. In my company we create a lot of bool
methods that return false
if there was an error. Example:
public bool Foo(string path, string fileName, ref string error)
{
if (path == null)
{
error = "path is null";
return false;
}
path += fileName;
return true;
}
As you can see it's ugly. I want to use it with exceptions like so:
public voidFoo(string path, string fileName, ref string error)
{
if (path == null)
{
throw new SomeException("Path is null.");
}
path += fileName;
return true;
}
But we worry about the overhead. Should we?