Greetings, I'm pretty new to C#, so sorry if this is a dumb question. I am trying to read a byte field on a System.DirectoryServices.PropertyValueCollection which contains a jpeg image to an http response stream. I am getting hung up on my lack of type casting knowlege in C#, as I can do this very easily in VB. Please help:
DirectoryEntry entry = new DirectoryEntry("LDAP://DC=blah,DC=com");
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(sAMAccountName=" + "blah" + ")");
SearchResult result = mySearcher.FindOne();
System.DirectoryServices.PropertyValueCollection props = result.GetDirectoryEntry().Properties["thumbnailPhoto"];
byte[] arraybytes = props[0]; // <--------This property should be an array of bytes, but this cast fails saying type object. What do I do
Visual C#6
|