We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 449da31 + 3b166a5 commit 62838e5Copy full SHA for 62838e5
src/Models/User.cs
@@ -1,4 +1,4 @@
1
-using System.Collections.Generic;
+using System.Collections.Concurrent;
2
3
namespace SourceGit.Models
4
{
@@ -36,11 +36,11 @@ public static User FindOrAdd(string data)
36
var email = data.Substring(nameEndIdx + 1);
37
38
User user = new User() { Name = name, Email = email };
39
- _caches.Add(data, user);
+ _caches.TryAdd(data, user);
40
return user;
41
}
42
43
44
- private static Dictionary<string, User> _caches = new Dictionary<string, User>();
+ private static ConcurrentDictionary<string, User> _caches = new ConcurrentDictionary<string, User>();
45
46
0 commit comments