I am making a command line utility. I need to pass around a few file paths in the program.
Right now I am just using string. But I was wondering if the .net library had a cool class for passing around file paths.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Strings are the best way to store paths.
If you need to modify or work with the path, though, you should use System.IO.Path.
If you want something that is a little more robust and can actually interact with files/directories you could also check out FileInfo and DirectoryInfo. Keep in mind, though, that both of these are awfully heavy if you just need to store the path.