Determining the underlying type of a a DirectoryAttribute

Oct 21, 2015 at 1:01 PM
When using the non generic Query method, I get IDirectoryAttributes back. And I'm just wondering if when drilling down to the DirectoryAttributes, is there a way to determine of an attribute is actually string or byte? both GetVAlues(typeof(string)) and GetValues(typeof(byte[])) return values..

Here's such a search. If I'm using System.DirectoryServices, the ResultPropertyValueConnection of a SearchResult allows me to check if an attribute is a byte[] or something else. Is there something similar with linq2ldap, a check that can be done on attr in the code below?
sing (var context = new LinqToLdap.DirectoryContext(config))
            {
                List<IDirectoryAttributes> users = context.Query(directoryOu).Where(filter).InPagesOf(10);
                foreach (IDirectoryAttributes res in users)
                {
                    SearchResultEntry entry = res.Entry;
                    foreach (string attribute in entry.Attributes.AttributeNames)
                    {
                        DirectoryAttribute attr = entry.Attributes[attribute];
                        string[] stringValues = attr.GetValues(typeof(string)) as string[];
                        object[] byteValues = attr.GetValues(typeof(byte[]));
                    }
                }
            }