ConcurrentDictionary がどのように機能するかを理解するのを手伝ってください。私はこれを持っています:
UsersOnlineClass client;
if (UsersOnlineDictionary.TryGetValue(comClientID, out client)) { }
クライアントでいくつかの値を変更し、変更を ConcurrentDictionary に保存する必要があります。そうですか?
UsersOnlineClass updatedClient = new UsersOnlineClass();
updatedClient = client; //make copy
updatedClient.someInt = -1;
if (UsersOnlineDictionary.TryUpdate(client.Client_id, updatedClient, client)) { }
または私はそうすることができます、そしてそれで十分でしょうか?
client.someInt = -1;