FSharpLint
FSharpLint copied to clipboard
Avoid double-lookup dictionaries: .ContainsKey key followed by indexer call .[key]
Avoid double-lookup dictionaries:
.ContainsKey key followed by .[key] should be replaced with .TryGetValue x
for example:
match xs.ContainsKey x with
| true -> ... xs.[x] ...
| false -> ///...
should be replaced with
match xs.TryGetValue x with
| true, xVal -> ... xVal ...
| false, _ -> ///...