092 – How to C# Path Class

1
11



C# provides effective ways of dealing with filenames and paths from its namespace System.IO . The Path Class performs operations on String instances that contain file or directory path information. The members of the Path class enable you to quickly and easily perform common operations such as returns filenae , extensios etc.

The following are the some important operations in C# Path Class:

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.

Get Current Application Path

C# Class application in System.Windows.Forms namespace has static property called ExecutablePath . To get the current application path we can use GetDirectoryName of Path class with ExecutablePath as parameter.

applicationPath = Path.GetDirectoryName(Application.ExecutablePath)
It will return the current directory path of the .exe file .

Moreover, you should also visit our:

Website:
Blog:
Shop:
FbPage:
Twitter:
Google+ :
YouTube:
Email: help@theengineeringprojects.com
Skype: theenggprojects
Mobile / WhatsApp : +92-332-6062060

Thanks for Watching.

Nguồn:https://wijstaanvooronzegrondrechten.org/

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here