Is there any difference between these two methods of moving a file?
System.IO.FileInfo f = new System.IO.FileInfo(@"c:\foo.txt");
f.MoveTo(@"c:\bar.txt");
//vs
System.IO.File.Move(@"c:\foo.txt", @"c:\bar.txt");
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.
Take a look at “Remarks” section in this MSDN page http://msdn.microsoft.com/en-us/library/akth6b1k.aspx :
I think this difference is most significant between
File(Directory) andFileInfo(DirectoryInfo) classes.Update: The same explanation in similar question: https://stackoverflow.com/a/1324808/380123