I program in WPF C#. I have e.g. the following path:
C:\\Program Files\\hello.txt
and I want to extract hello
hello
Try this,
string FilePath=@"C:\mydir\myfile.ext"; string Result=Path.GetFileName(FilePath);//With Extension string Result=Path.GetFileNameWithoutExtension(FilePath);//Without Extension