Reading Properties with Multiple Values
.NET Framework 2.0
This topic provides information and code examples for reading properties that contain multiple values. As with properties that contain a single value, properties with multiple values are read using the Value property from the PropertyValueCollection object.
For properties that contain multiple values, use either a foreach statement to retrieve a Properties collection, or enumerate property values using an array.
The following code example uses the Properties collection to read multiple values.
DirectoryEntry ent = new DirectoryEntry("LDAP://Fabrikam/CN=My Username,CN=Users,DC=Fabrikam,DC=com"); foreach(String s in ent.Properties["otherTelephone"] ) { Console.WriteLine(s); }
The following code example uses an array to read values.