The user chooses multiple files through dialogBox:
OpenFileDialog dialF = new OpenFileDialog();
DialogResult dialR = dialF.ShowDialog();
filesRepNames = dialF.FileNames; // save the name of files for later use
And these files are stored in an array of string. The name ( for each) is the full address of the file. I just want to store the name of the file by its own,Not whole the full address of each file. Is there any way to store only the filename but not the whole information.
example) I don’t want:
D:\margin\2012\Cam\bin\Debug\action.JPG
I want only:
action.jpg
Note that these are Multiple Files not one,otherwise I could use the property “fileinfo”
You can use LINQ with method Path.GetFileName: