Possible Duplicate:
VB.NET to C# - my.computer.getfiles()
Can any one tell me the equivalent of following vb.net code 'My.Computer' methods in C#.?
My.Computer.FileSystem.RenameFile(oldname,newname)
My.Computer.FileSystem.DeleteFile(filename)
Thanks in advance..
From the documentation
Use the File class for typical operations such as copying, moving, renaming, creating, opening, deleting, and appending to files. You can also use the File class to get and set file attributes or DateTime information related to the creation, access, and writing of a file.
You can use System.IO.File
to do most of the things that my limited knowledge of VB said My.Computer.FileSystem
could do.
The methods are still static, and take in the path of the file you wish to manipulate. So for the examples you provided...
File.Move(oldname, newname); //File renames things just like Unix does- by moving them
File.Delete(filename);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With