This article explains the file management class of C# to help you gain a simple understanding of the general functions of the class.
When this example is applied to a C# project, determine whether the file exists, create files, delete files, etc.; today, the file call function is summarized as follows:
public string GetFile() {//Get the so file in the root directory string Files = ""; string[] Wenjian = (("~/")); foreach (string item in Wenjian) { FileInfo info = new FileInfo(item); Files += "file name:" + + ";File Type" + + ";File size:" + + ";Create time:" + + "<br/>"; } return Files; } public string Folder() {//Get the so folder in the root directory string Folders = ""; string[] wj = (("~/")); foreach (string item in wj) { DirectoryInfo info = new DirectoryInfo(item); Folders += "Folder Name:" + + "<br/>"; } return Folders; }
Interested readers can debug the examples described in this article and apply them to their own projects.