Path is one of the most underused, but a very useful class in System.IO namespace. It is a static class that performs operations on string file or directory information. It has a bunch of static methods dealing with string paths.
A path is generally a string containing information of a file or directory,it can also be absolute or relative path. Absolute path specifies the physical full location, while a relative path specifies a partical location relating the current location
Though the Path class is in System.IO namespace, it has nothing to do with file or directory. It's members or operations has no effect on the file or directory, they purly deal with file names and paths
Methods of Path Class
ChangeExtension - Changes the extension of a path string. Combine - Combines two path strings. GetDirectoryName - Returns the directory information for the specified path string. GetExtension - Returns the extension of the specified path string. GetFileName - Returns the file name and extension of the specified path string. GetFileNameWithoutExtension - Returns the file name of the specified path string without the extension. GetFullPath - Returns the absolute path for the specified path string. GetInvalidFileNameChars - Gets an array containing the characters that are not allowed in file names. GetInvalidPathChars - Gets an array containing the characters that are not allowed in path names. GetPathRoot - Gets the root directory information of the specified path. GetRandomFileName - Returns a random folder name or file name. GetTempFileName - Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file. GetTempPath - Returns the path of the current system's temporary folder. HasExtension - Determines whether a path includes a file name extension. IsPathRooted - Gets a value indicating whether the specified path string contains absolute or relative path information.
Happy Coding !!!
|
No responses found. Be the first to respond and make money from revenue sharing program.
|