Get user names of Active Directory group in c#
<p>I need to get user details of a particular Active Directory group. I am using this  code:</p>

<pre><code>var result = grpResponse.Entries[0];

if (result.Attributes["member"] != null)
{
    for (var i = 0; i &lt; result.Attributes["member"].Count; i++)
    {
          var filter = result.Attributes["member"][i].ToString();

          var query = "(&amp;(objectClass=user)(" + filter + "))"; // Here I need username to use like cn=username

          var userRequest = new SearchRequest(distinguishedName, query,
                                    SearchScope.Subtree);
</code></pre>

<p>In filter I am getting something like </p>

<pre><code>CN=Name,OU=something,DC=example
</code></pre>

<p>How can I take this cn value i.e user name alone?</p>