System.IO.Path



GetFileName

string filename = @"C:\test\myfile.txt";
string path = @"c:\text\";
string result;


result = System.IO.Path.GetFileName(filename); 
Console.WriteLine("GetFileName ('{0}') returns '{1}'", _
                                  filename, result);

result = System.IO.Path.GetFileName(path); 
Console.WriteLine("GetFileName ('{0}') returns '{1}'", _
                                  path, result);


© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext