Path and Environment: Truly useful classes

I always remember doing painful string manipulations on a file path string, either to extract the drive, the file name or the extension bits from the string in VB6. Things are definitely better in .NET. The System.IO.Path class basically abstracts the way a path string is structured and provides a set of simple helper methods which also absolves a developer from knowing things like the directory separator character, Volume separator character and so on. Saravanaa good friend of mine, explains more on this in his article.


Another really useful class is System.Environment, whichs comes packed with plentiful handy functions to get environment information like environment variables, system directory, etc etc. Check this MSDN link for a complete listing.


Really useful, I must say.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>