.NET Framework provides you with a class for working with file paths. The System
.IO.Path class has many static methods to work with paths.
Some static methods are
Here are sample example for this.
.IO.Path class has many static methods to work with paths.
Some static methods are
ChangeExtension()
Combine()
GetDirectoryName()
GetExtension()
GetFileName()
GetFileNameWithoutExtension()
GetFullPath()
GetInvalidFileNameChars()
GetInvalidPathChars()
GetPathRoot()
GetTempFileName()
GetTempPath()
HasExtension()
IsPathRooted()
Combine()
GetDirectoryName()
GetExtension()
GetFileName()
GetFileNameWithoutExtension()
GetFullPath()
GetInvalidFileNameChars()
GetInvalidPathChars()
GetPathRoot()
GetTempFileName()
GetTempPath()
HasExtension()
IsPathRooted()
Here are sample example for this.
string strFilePath = "D:\\Others\\bookmarks.html";
Response.Write(Path.GetPathRoot(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetDirectoryName(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetFileName(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetFileNameWithoutExtension(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetExtension(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetTempPath());
Response.Write("</br>");
Response.Write(Path.DirectorySeparatorChar.ToString());
Response.Write("</br>");
Response.Write(Path.AltDirectorySeparatorChar.ToString());
Response.Write("</br>");
Response.Write(Path.VolumeSeparatorChar.ToString());
Response.Write("</br>");
Response.Write(Path.PathSeparator.ToString());
Response.Write("</br>");
Response.Write(HttpUtility.HtmlEncode(new String(Path.GetInvalidPathChars())));
Response.Write("</br>");
Response.Write(HttpUtility.HtmlEncode(new String(Path.GetInvalidFileNameChars())));
Response.Write("</br>");
Response.Write(Path.GetPathRoot(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetDirectoryName(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetFileName(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetFileNameWithoutExtension(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetExtension(strFilePath));
Response.Write("</br>");
Response.Write(Path.GetTempPath());
Response.Write("</br>");
Response.Write(Path.DirectorySeparatorChar.ToString());
Response.Write("</br>");
Response.Write(Path.AltDirectorySeparatorChar.ToString());
Response.Write("</br>");
Response.Write(Path.VolumeSeparatorChar.ToString());
Response.Write("</br>");
Response.Write(Path.PathSeparator.ToString());
Response.Write("</br>");
Response.Write(HttpUtility.HtmlEncode(new String(Path.GetInvalidPathChars())));
Response.Write("</br>");
Response.Write(HttpUtility.HtmlEncode(new String(Path.GetInvalidFileNameChars())));
Response.Write("</br>");
Nice information....
ReplyDeleteCoronavirus Update
Intern Ship In Chennai
Inplant Training In Chennai
Internship For CSE Students
Online Internships
Internship For MBA Students
ITO Internship