Write a method to get only the name of a file from the complete path string in C#.

Use a FileInfo class and instantiate its object with the full path as the constructor argument and then simply call the FileInfo.Name file and you will get just the name of the file.