Combining Paths

December 5, 2008 · 1 minute read · generic .net

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!

Published: 2017-10-23 19:16:31 +1100 +1100, Version: 7c4a504