Combining Paths

Friday, Dec 5, 2008 1 minute read Tags: generic .net
Hey, thanks for the interest in this post, but just letting you know that it is over 3 years old, so the content in here may not be accurate.

Maybe I'm a slow learner or maybe this is one of those beautifully hidden features of the .NET framework but I came across a nifty little static method (thanks to this post on StackOverflow), Path.Combine(string1, string2);

I can't count the number of times I'd written a method to ensure a trailing \, and append one if it didn't exist, all because of some lack-of-knowledge.

So keep this method handy in your knowledge bag for next time you are building file system paths!