Let me introduce to you several methods of the Path class in .NET:
1. Path.combine(string, string)
Returns a path given the two paths given.
For example:
string CompletePath = System.IO.Path.Combine(@"c:MyApp", @"Imagesskyline.jpg");
Will return a full path c:MyAppImagesskyline.jpg
It doesn’t matter whether the first parameter ends with "".
2. Path.GetExtension(string)
Returns the extension of the given file path. For example:
string FileExtention = System.IO.Path.GetExtention(@"C:MyAppImagesskyline.jpg");
Will return "jpg"
3. Path.GetFileName(string)
Given the full path of the file name, return the file name (including extension). For example:
string fileName = System.IO.Path.GetFileName(@"c:MyAppImagesskyline.jpg");
will return "skyline.jpg"