Пример #1
0
        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);
        }
Пример #2
0
        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);
        }