public async Task <VstsSecurityNamespace> GetNamespaceAsync(SecurityNamespaceConstants securityNamespace) { var sv = securityNamespace.GetStringValue(); var all = await GetAllNamespacesAsync(); var ns = all.Value.FirstOrDefault(sn => sn.Name.Equals(sv, StringComparison.OrdinalIgnoreCase)); return(ns); }
public static string GetStringValue(this SecurityNamespaceConstants value) { var enumType = typeof(SecurityNamespaceConstants); var memberInfos = enumType.GetMember(value.ToString()); var enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == enumType); var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(DescriptionAttribute), false); var description = ((DescriptionAttribute)valueAttributes[0]).Description; return(description); }