Compare 2 List to get a List with active players I have a little problem: I have a list with all the users that have logged in the game and a list that has all the names of the active players and I make a List with all the players as a List&lt;T&gt; (It's a Lists  List).

public void CheckNames()
{
    results.Clear();
    for (int i = 0; i &lt; TC.chatters.viewers.Length; i++)
    {
        if (!TotalPlayerNames.Contains(TC.chatters.viewers[i]))
        {
            TotalPlayerNames.Add(TC.chatters.viewers[i]);
            TotalPlayers.Add(new PlayerReal(TC.chatters.viewers[i]));
        }
        if (TotalPlayerNames.Contains(TC.chatters.viewers[i]))
        {
            results.AddRange(TotalPlayers.FindAll(x =&gt; x.displayName == TC.chatters.viewers[i]));
            for (int j = 0; j &lt; results.Count; j++)
            {
                results[j].active = true;
            }

        }
    }

    ActivePlayers = results;
    for (int k = 0; k &lt; TotalPlayers.Count; k++)
    {
        bool check = false;
        for (int i = 0; i &lt; TC.chatters.viewers.Length; i++)
        {

            if (TotalPlayers[k].displayName == TC.chatters.viewers[i] &amp;&amp; !check)
            {
                TotalPlayers[k].active = true;
                check = true;
            }
            else if (TotalPlayers[k].displayName != TC.chatters.viewers[i] &amp;&amp; !check &amp;&amp; ((TC.chatters.viewers.Length-1)==i))
            {
                TotalPlayers[k].active = false;
                check = true;
            }

        }
    }
}


There's no problem if I have 100-300 players playing but I DO have a huge problem if 1000-10000 players are playing... any help on this? This method executes each 20 seconds.
Please use conventional naming of properties. Chatters instead of chatters for example.

Also, why do you use for instead of foreach if you use index only to get an element of collection? Use foreach and your code will be much clearer.

First thing that should come into your mind when you encounter many Contains and !Contains calls which need to determine if an element should be added into a collection is to use HashSet. Use HashSet&lt;string&gt; for TotalPlayerNames and TC.Chatters.Viewers.

Main problem of your code is a lot of repeating loops and duplications like TC.chatters.viewers[i]. Please learn programming basics and particularly C# basics.

All your code can be rewritten like:

var viewers = TC.Chatters.Viewers;

TotalPlayers.AddRange(viewers.Where(v =&gt; TotalPlayerNames.Add(v))
                             .Select(v =&gt; new PlayerReal(v)));

var activePlayers = new List&lt;PlayerReal&gt;();
foreach (var player in TotalPlayers)
{
    player.Active = viewers.Contains(player.DisplayName);
    if (player.Active)
        activePlayers.Add(player);
}

ActivePlayers = activePlayers;