0

In an ASP.NET Core 1.1 app with Individual User Accounts authentication, I'm trying to display a dropdown of Users in an ascending order. But the VS2015's Intellisense does not recognize the .OrderBy(u => u.Value) of the code below. Why is that?. I then end up using OrderBy on the `.Select(u => new SelectListItem { Value = u.UserName, Text = u.UserName }) that, as expected, works. [Ref: UserManager class]

public IActionResult GetUserList()
{
    var UserListVM = new UsetListViewModel()
    {
        UserList = _userManager.Users.OrderBy(u => u.Value).Select(u => new SelectListItem { Value = u.UserName, Text = u.UserName }).ToList()
    };
    return View(UserListVM);
}
nam
  • 21,967
  • 37
  • 158
  • 332
  • The linked article is about ASP.NET Identity 2.x, not about ASP.NET Core Identity. Also do you import `System.Linq`? – Tseng Mar 06 '17 at 20:46
  • @Tseng Yes, `using System.Linq;` is imported by default. Also, in the same controller, I can use `Orderby` on custom tables, e.g.: `_context.myTable.OrderBy(t =>t.ColName)....` – nam Mar 06 '17 at 21:47

0 Answers0