.Net Pearls -1 System.IO.Path

It’s been a while since I wrote my lost blog post. I thought start it again. Recently I was looking for a get the extn for a file. Initially it took some time for me to get extension and finally I realized System.IO.Path

Two mostly use full methods in System.IO.Path
class is “GetFileName” and “GetExtension”

    var extn = System.IO.Path.GetExtension(@”c:\temp\text.txt”);

            // Result = .txt


    var fileName = System.IO.Path.GetFileName(@”c:\temp\text.txt”);

            //Result = text.txt


And finally there may other use full methods in in it.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s