Getting the list of users from AD is bit tricky. Firstly the call is Asynchronous and it is delayed. So no such straight forward foreach loop can help, Define the data model
After that we can write something like,
UserId = userValue.ObjectId,
UserPrincipleName = userValue.UserPrincipalName
} while (userList.MorePagesAvailable);
dataGridView1.DataSource = userData;
I have displayed the data in a Grid you may handle it as per your need.