Q:

how can get List of users in active directory using LINQ to LDAP?

I want to access to ActiveDirectory using LINQ to LDAP and I want to Get List of All users in that
how can I do that?

A:

You can try something like below.
using ActiveDs;
using BdsSoft.DirectoryServices.Linq;
using System.Linq.Expressions;
using System.DirectoryServices;

[DirectorySchema( "user", typeof( IADsUser ) )]
class User
{
    public string Name { get; set; }

    public string sAMAccountName { get; set; }

    public string objectCategory { get; set; }

    public string mail { get; set; }

    public string Description { get; set; }

    [DirectoryAttribute( "PasswordLastChanged", DirectoryAttributeType.ActiveDs )]
    public DateTime PasswordLastSet { get; set; }

    [DirectoryAttribute("distinguishedName")]
    public string Dn { get; set; }

    [DirectoryAttribute("memberOf")]
    public string[] Groups { get; set; }

}

Use this code to access AD from a console app, placing your AD server in the below code:
static void Main( string[] args )
{

    IEnumerable<User> users = GetADUsers();

    Console.WriteLine( "Users: " + users.Count().ToString() );

}

static DirectoryEntry ROOT = new DirectoryEntry( "LDAP://MyADDomainLocation.com" );

private static IEnumerable<User> GetADUsers()
{
    IEnumerable<User> users;

    var usersDS = new DirectorySource<User>( ROOT, SearchScope.Subtree );

            users = from usr in usersDS
                    where usr.Name == "A*" // FIlter A then any character(s)
                    select usr;

     users = users.OrderBy( user => user.Name ).ToList(); // Sort them alphabetically by name.

    return users;
}

For more information check Get All Users using C# with Linq To Active Directory
and LINQ to LDAP
For .NET Core or Standard, please see Chris D's answer, below.
For get comprehensive knowledge about this subject check (Almost) Everything In Active Directory via C#
I hope this will help to you.

