C# JoinUrl / CombineUrl

Date: 2018-03-23
public static string JoinUrl(string baseUrl, params string[] parts)
{
    var partList = new List<string>();
    partList.Add(baseUrl.TrimEnd('/'));
    foreach (string part in parts)
    {
        if (!String.IsNullOrEmpty(part)) partList.Add(part.TrimStart('/'));
    }
    return String.Join("/", partList);
}
10680cookie-checkC# JoinUrl / CombineUrl