Skip to content

Commit b90f358

Browse files
authored
Add files via upload
support attributes with multiple values
1 parent f7c9a2b commit b90f358

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

SharpLDAPSearch/Program.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,19 @@ static void Main(string[] args)
4545
ResultPropertyCollection myResultPropColl;
4646
myResultPropColl = mySearchResult.Properties;
4747

48-
// return only specified fields
48+
// return only specified attributes
4949
if (searchProperties.Count > 0)
5050
{
5151
foreach (string attr in searchProperties)
5252
{
53-
Console.WriteLine(mySearchResult.Properties[attr][0].ToString());
53+
// some attributes - such as memberof - have multiple values
54+
for (int i = 0; i < mySearchResult.Properties[attr].Count; i++)
55+
{
56+
Console.WriteLine(mySearchResult.Properties[attr][i].ToString());
57+
}
5458
}
5559
}
56-
// if no fields specified, return all
60+
// if no attributes specified, return all
5761
else
5862
{
5963
foreach (string myKey in myResultPropColl.PropertyNames)

0 commit comments

Comments
 (0)