-3

query.First().Username;

query.tolist()

don't give option about username.

Dmitry Bychenko
  • 180,369
  • 20
  • 160
  • 215

1 Answers1

1
query.Select(x => x.Username).ToList();

This will give you a list of all the usernames

David Pilkington
  • 13,528
  • 3
  • 41
  • 73
  • 'schoolmanagement.Student' does not contain a definition for 'Username' and no extension method 'Username' accepting a first argument of type 'schoolmanagement.Student' could be found (are you missing a using directive or an assembly reference?) – Fahad Rehman Aug 27 '15 at 07:58
  • `query.First().Username;` if this works then you are doing something else incorrect – David Pilkington Aug 27 '15 at 08:00