You could use a ConcurrentDictionary instead. GetProcessForConection would be implemented by GetOrAddValue in that case