3
I’m trying to avoid duplicate data before giving a set value. I have a class Player that has itself a property called NickName, this class is inserted in List.
Player class:
public class Player
{
public string NickName { get; set; }
}
On the part of set, I need to insert everything into the variable player, where there is no player.NickName.
Metodo get and set:
public List<Player> player = new List<Player>();
public List<Player> Player
{
get { return player; }
set { player = value.Where(x => !player.Contains(x.NickName)); }
}
The above model gives error saying that it is not possible to convert string for Player. How can I do it the right way?