I was trying to read a property value from the user schema of an Active Directory, the mystery is that the value data type sometimes comes as byte[] & sometimes as String. As much as I do not like it, I have to rely on the type for further processing..
System.Type type = objectTemp.GetType(); if (type == typeof(String)) this.property1= objectTemp.ToString(); if (type == typeof(byte[])) { this.property1= System.Text.Encoding.Default.GetString((byte[])objectTemp); }
Leave a Reply