Reputation: 69
I have the following list class
public class Users
{
public string Username
{
get;
set;
}
public string PlayerID
{
get;
set;
}
}
I was wondering how do I select the playerID where username = x ?
Upvotes: 0
Views: 1435
Reputation: 144136
var player = playerList.FirstOrDefault(p => p.Username == "x");
if(player != null)
{
string id = player.PlayerID;
}
Upvotes: 1