I want to load the UserName from my table (who match the UserName in Settings.Default) ToList. Please see code below:
private void LoadUserData()
{
var item = context.Users.FirstOrDefault(w => w.UserName == Properties.Settings.Default.UserName).ToList();
userList = item;
}
It says: User has no definition for ToList.
how can i solve this? Any idear?
Remove the
ToList()at the end of your statement.ToListis to create aList<T>fromIEnumerable<T>.In case you have more users with the same UserName (hopefully not) you can get a list of those user by: