Skip to content

Avoid double-lookup dictionaries: .ContainsKey key followed by indexer call .[key] #706

@Thorium

Description

@Thorium

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, _ -> ///...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions