J
Jerry Negrelli
I was enumerating a collection and printing the value of
each data item when I noticed that some of the objects in
the collection returned "System.Object[]" from
their .ToString() method.
Assuming that they aren't literally strings with the
value "System.Object[]", how can I convert one of these
objects to an object array? Reflection?
Convert.ChangeType?
My code:
DirectoryEntry parent = new DirectoryEntry
(@"LDAP://RootDSE");
IEnumerator bob =
parent.Properties.PropertyNames.GetEnumerator();
while(bob.MoveNext()){
if(parent.Properties[bob.Current.ToString
()].Value.GetType().IsArray){
Response.Write("my array: " + parent.Properties
[bob.Current.ToString()].Value.ToString());
}
}
JER
each data item when I noticed that some of the objects in
the collection returned "System.Object[]" from
their .ToString() method.
Assuming that they aren't literally strings with the
value "System.Object[]", how can I convert one of these
objects to an object array? Reflection?
Convert.ChangeType?
My code:
DirectoryEntry parent = new DirectoryEntry
(@"LDAP://RootDSE");
IEnumerator bob =
parent.Properties.PropertyNames.GetEnumerator();
while(bob.MoveNext()){
if(parent.Properties[bob.Current.ToString
()].Value.GetType().IsArray){
Response.Write("my array: " + parent.Properties
[bob.Current.ToString()].Value.ToString());
}
}
JER