Skip to content

Enrich the AvaloniaDictionary constructor #17311

@IoannTerrible

Description

@IoannTerrible

Currently, the AvaloniaDictionary class only provides two constructors, which limits the flexibility when initializing it with an existing dictionary. Often, developers have a ready-made Dictionary<TKey, TValue> that they wish to convert into an AvaloniaDictionary, but they lack a straightforward constructor for this purpose.

I propose adding a new constructor to the AvaloniaDictionary class that accepts an existing Dictionary<TKey, TValue>. This would simplify the process of converting an existing dictionary to an AvaloniaDictionary. The constructor would look like this:

    public AvaloniaDictionary(Dictionary<TKey, TValue> initialDictionary)
    {

        _inner = new Dictionary<TKey, TValue>(initialDictionary);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp-wantedA contribution from the community would be most welcome.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions