Skip to content

Instantly share code, notes, and snippets.

@yura415
Created September 29, 2014 13:08
Show Gist options
  • Save yura415/012c0d8e9461e7813c73 to your computer and use it in GitHub Desktop.
Save yura415/012c0d8e9461e7813c73 to your computer and use it in GitHub Desktop.
Path.Combine with params attribute using Linq in NET 3.5
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