using System; using System.Linq; namespace ICD.Common.Utils.Extensions { public static class UriExtensions { /// /// Gets the username from the given URI. /// /// /// public static string GetUserName(this Uri extends) { if (extends == null) throw new ArgumentNullException("extends"); return extends.UserInfo.Split(':').FirstOrDefault(string.Empty); } /// /// Gets the password from the given URI. /// /// /// public static string GetPassword(this Uri extends) { if (extends == null) throw new ArgumentNullException("extends"); return extends.UserInfo.Split(':').Skip(1).FirstOrDefault(string.Empty); } } }