Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Dictionary get indexer used incorrectly #75

@sharwell

Description

@sharwell

In Java, Map.get returns null when an element does not exist. In C#, the get indexer for IDictionary<TKey, TValue> throws an exception in the same scenario. Currently calls to get are getting translated into indexer usage, but this breaks the semantics for this operation. The correct code for this case would be the following:

Java:

T value = map.get(key);

C#:

T value;
map.TryGetValue(key, out value);

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