I got instance of “FileInfo” in C#.
The path of this object such as “C:\path1”
How can I change every related fields(there are a lot I noticed) to this to “C:\path2”
thanks.
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.
You can’t. FileInfo is just a pointer to some existing file and thus the properties are readonly. There are other Path manipulation classes that allow you to extract filenames only and combine them with other paths.