Inheritance: ICollection, IEnumerable
Example #1
0
        private void GetADProperties(System.DirectoryServices.SearchResult result)
        {
            if (result.Properties.Count > 0)
            {
                //System.Collections.ICollection nameList = this.searchResult.Properties.PropertyNames;
                //System.Collections.ICollection valueList = this.searchResult.Properties.Values;

                foreach (System.Collections.DictionaryEntry item in this.searchResult.Properties)
                {
                    //var itemKey = item.Key;
                    //var itemValue = item.Value;
                    System.Collections.ReadOnlyCollectionBase valueList = ((System.Collections.ReadOnlyCollectionBase)(item.Value));
                    foreach (var valuekey in valueList)
                    {
                        //Assign prop to List<string, string>
                        if (ADProperties.Where(x => x.Key == item.Key).Count() == 0)
                        {
                            ADProperties.Add(Convert.ToString(item.Key), Convert.ToString(valuekey));
                        }
                    }
                }
            }
        }