views:

118

answers:

4

Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path "C:\foo" and a subdirectory "bar". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method for this in .NET, or do I need to handle this myself?

+2  A: 

System.IO.Path.Combine is the one you're looking for. There's quite a few useful methods on the Path class.

Rik Garner
+1  A: 

Path.Combine is the way to go.

Dario Solera
+7  A: 

This is your friend: http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx

torial
+1  A: 

System.IO.Path.Combine

Luke Bennett