Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use fileName or filePath to describe a fully qualified file name in .NET? [closed]

Tags:

.net

I have a method to read a file, the parameter should be the fully qualified file name.
The code I have uses fileName, filePath, or path randomly.

void ReadSomeFile(String fileName);
void ReadSomeFile(String filePath);
void ReadSomeFile(String path);

The .net method "File.Exists(string path)" uses path, but "FileDialog.FileName" uses fileName.
Which name do you suggest to use?

like image 942
AZ. Avatar asked Sep 16 '25 19:09

AZ.


1 Answers

I, personally, would use filePath, as it's the most explicit.

That being said, whatever you choose, I would make sure that your documentation explicitly states that you require the fully qualified file name with path, if that is required by your method.

like image 117
Reed Copsey Avatar answered Sep 18 '25 09:09

Reed Copsey