The Most Useful .NET Utility Classes Developers Tend To Reinvent Rather Than Reuse
Posted by: youve been HAACKED,
on 14 Jun 2007 |
View original | Bookmarked: 0 time(s)
System.IO.Path
How often do you see code like this to create a file path?
public string GetFullPath(string fileName)
{
string folder = ConfigurationManager.AppSettings["somefolder"];
return folder + fileName;
}
Code like this drives me crazy because it is so prone to error. For example, when you set the folder setting, you have to remember to make sure it ends with a slash. Having too many things to remember makes this setup fragile.
Sure, you write some code to ensure that the folder has...