标签:获取 uri 目录 parent scheme tran param summary 完整
/// <summary> /// 获取上级目录 /// </summary> /// <param name="url">完整Url</param> /// <returns></returns> public string GetParentDirectory(string url) { return GetParentDirectory(new Uri(url)); } /// <summary> /// 获取上级目录 /// </summary> /// <param name="uri">uri</param> /// <returns></returns> public string GetParentDirectory(Uri uri) { return uri.Scheme + "://" + uri.Host + string.Join("", new List<string>(uri.Segments).GetRange(0, uri.Segments.Length - 1)); }
标签:获取 uri 目录 parent scheme tran param summary 完整
原文地址:https://www.cnblogs.com/ChenRihe/p/10325919.html