public bool TryGetValue(string attribute, out DirectoryAttribute item) { item = this.FirstOrDefault(x => string.Equals(x.Name, attribute, StringComparison.OrdinalIgnoreCase)); if (item == null) { return(false); } return(true); }
public DirectoryEntry ToDirectoryEntry() { var directoryEntry = new DirectoryEntry { Dn = Dn, Attributes = new SearchResultAttributeCollection() }; foreach (var attr in Attributes) { var item = new DirectoryAttribute { Name = attr.Key }; item.AddValues(attr.Value); directoryEntry.Attributes.Add(item); } return(directoryEntry); }