Possible Duplicate:
Figuring out whether string is valid file path?
In C# check that filename is *possibly* valid (not that it exists)
I have a method that expects a string which represents a file name with its full path.
I want to validate (Guard) this string in terms of its format to see whether it CAN really represent a file name (not the correctness of the path whether it exists or not)?
For example it should not be accepted if it is something like : "123C:\foo\"
What is the easiest way to do this check in C# ?
public void LoadFile(string fileName)
{
  var valid = Check if 'fileName' is in valid format.
  if(!valid)
      throw new ArgumentException(....
}
 
     
    