Getfilename-GetExtension

Getfilename-GetExtension


 Here is simple way to get file name or extension of the file at specified string.

you need to use System.IO namespace

e.g.

 string path =  "
http://revenmerchantservices.com/default.aspx";

string fileName  = System.IO.Path.GetFileName(path));

To get extension you can use GetExtension function

Now, you learned this technique hope you will use it instead of writting your own logic.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5