Daily Archives: May 4, 2007

You know you’re a geek when…

You get excited by classes like FileInfo. The FileInfo class in the .net framework appears to solve most of those annoying filename/path handling problems that always used to involve plenty of string manipulation and lots of dodgy assumptions.

You can create an object of the FileInfo class with a relative or absolute path and then ask it for the various parts of the file/path. If you give it a relative path it can still give you a sensible full path. It also allows you to do the standard stuff like check to see if the file exists. All in all very simple and useful.

FileInfo iniFile = new FileInfo("myprogram.ini");
if(iniFile.Exists)
{
    IniFile ini = new IniFile(iniFile.FullName);
   // read the ini file settings.
}
Follow

Get every new post delivered to your Inbox.

Join 58 other followers