Geeks With Blogs
Dave Chestnutt: SparklingCode and CodeGaffes Writing better code; for fun and profit March 2007 Entries
Path.Combine() - parameters are mis-named
The CLR is full of surprises. Microsoft has a built-in System.IO.Path class, to deal with all the path parsing issues we often run across. One of the most useful methods in there can get rid of all the special case code we write to combine path strings. How many times have you written something like this to combine two path strings -- taking into account whether you need to add a slash between the path strings or not: String path1 = @"C:\ABC"; // may or may not end in a slash String path2 = @"DEF"; ......

Posted On Tuesday, March 13, 2007 4:09 PM

Copyright © Dave Chestnutt | Powered by: