Created
September 29, 2014 13:08
-
-
Save yura415/012c0d8e9461e7813c73 to your computer and use it in GitHub Desktop.
Path.Combine with params attribute using Linq in NET 3.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
public class Hello | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine(Combine("/var/test", "123", "fsfsfs/sfwfw", "..", "wffw")); | |
//Should write /var/test/123/fsfsfs/wffw | |
} | |
static string Combine(params string[] path) | |
{ | |
return path.Aggregate(Path.Combine); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment