Split function; discard all data before the last instance of a delimiter
Okay so what I'm trying to do is get the filename from OpenFileDialog/SaveFileDialog, only without the full path, and dump said filename into a variable so I can use it for 开发者_如何学编程other things.
Using the Split function, I can get any part of the array between the delimiters ("\"), but what I'm trying to do is get all the information after the LAST delimiter in the string.
You could use Path.GetFileName to get the file name.
Why not convert this to a Fileinfo object and pull the name property?
(MSDN Link)
精彩评论