C # essays essays essays

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

11.4  Path

  Each drive includes one or more directories, and each directory structure in turn may comprise one or more subdirectory, directory tree structure. A file can be saved in a specific directory tree structure, the location of the file path. To retrieve a file, you must first determine the path of the file. Path from the drive letter, directory name, file name, file extension and separators composed of a variety of two ways: as from the root of the drive starts writing, such as C: \ Windows \ System32 \ notepad.exe, this path is called an absolute path; the other is to start writing from the current directory location, as System32 \ notepad.exe (assuming the current directory C: \ Windows), this path is called a relative path.

  In C #, to be careful when using file and directory paths. C # backslash '\' escape character considered, so that when the path is expressed as a string, to use two backslash, for example:

“C:\\Windows\\System32\\notepad.exe”

  In addition, C # allows you to add "@" sign in front of the string to prompt the compiler not to "\" character treated as an escape character, and treated as an ordinary character, such as:

@”C:\Windows\System32\notepad.exe”

  .NET Framework provides Path class to aid in the program management file and directory paths, Path class located System.IO namespace, is a static class, can be used to route each field operation, such as a drive letter, directory name , file name, file extension and separators and so on. Common field member Path class are PathSeperator (path separators, such as ";"), DirectorySeparatorChar (directory separator, such as "\"), VolumeSeparator (volume separator, such as ":"), AltDirectorySeparator (alternative directory separator, such as "/"), commonly used method members GetDirectoryName (take a directory name), GetFileName (take the file name), GetExtension (take the file extension), GetFullPath (take full path), GetTempPath (temporary files take operating system's path) like, for example, the following code extract and display indicates the directory path and file names.

string path = @"c:\windows\System32\notepad.exe";

Console.WriteLine(Path.GetDirectoryName(path));

Console.WriteLine(Path.GetFileName(path));

  Among them, a directory called "C: \ Windows \ System32", a file named "notepad.exe".

File operations Daquan good article

https://www.cnblogs.com/fengyeqingxiang/archive/2019/06/14/11022000.html

 

https://blog.csdn.net/bruce135lee/article/details/81081849

 

Detailed string.fomat

https://www.cnblogs.com/babietongtianta/p/4958189.html

 

 219.11.20

OUT ref learning methods   

ref: value of a variable can be changed into a process, then changing the efferent   

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/jiemohuasheng/p/11896633.html