Get file name from a path string in CSharp
Description
The following code shows how to get file name from a path string.
Example
using System;/*w ww. j a va 2s .c o m*/
using System.Diagnostics;
using System.IO;
class TestPathApp {
static void Main(string[] args) {
Console.WriteLine(Path.GetFileName("c:/abc/def/test.cs"));
}
}
The code above generates the following result.