using (SPSite site = new SPSite(siteUrl))
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
foreach (UserProfile userProfile in profileManager)
Console.WriteLine(userProfile[PropertyConstants.UserName].Value);
}