I would prefer an overload with an additional boolean parameter. If the
parameter is set to true, the method throws an exception >if a caller does
not have permissions and returns false in case where file does not exists,
but permissions are sufficient. If the >parameter is set to false, it works
as it is now...
I don't know if I would agree to this. The action Exists, defined by its
name, exposes one intention revealing purpose, to see if a file exists. The
File.Exists action of checking for security permissions and then returning
false, is not revealed in the name Exists, it fools the user and then forces
the user to know whats going on inside when it does not behave as its name
implies, hence your problem. Its bad design.
Stan said:
I would prefer an overload with an additional boolean parameter. If the
parameter is set to true, the method throws an exception if a caller does
not have permissions and returns false in case where file does not exists,
but permissions are sufficient. If the parameter is set to false, it works
as it is now...