I have a static readonly dictionary. No modifications will be made to this dictionary.
I have multiple threads reading from this dictionary using the .ContainsKey(Key). e.g.
class MyData
{
private static private IDictionary<int, string> _dictionary = new Dictionary<int, string>();
MyData()
{
// Load Dictionary here
}
public string GetValue(int key)
{
if (_dictionary.ContainsKey(key))
{
return _dictionary[key];
}
}
}
Are there any threading problems with doing this?