Skip to content

reorder of dictionary values when loading from IConfiguration into a Dictionary<string,string> using bind #1420

@3GDXC

Description

@3GDXC

Configuration section
"Menu": {
"Home": "#",
"General Feedback": "/Questionnaire?form=1",
"Request Callback": "/Questionnaire?form=2",
"Raise Complaint": "/Questionnaire?form=3"
}

var menu = new Dictionary<string,string>();
configuration.Bind("Menu", menu);

foreach(var item in menu)
Console.WriteLine($"KEY :{item.Key}, VALUE: {item.Value}");

--- OUTPUT
KEY: General Feedback, VALUE: /Questionnaire?form=1
KEY: Home, VALUE: #
KEY: Raise Complaint, VALUE: /Questionnaire?form=3
KEY: Request Callback, VALUE: /Questionnaire?form=2

Note the order of the values has changed, and this is a unexpected behavior which can cause issues; please allow options to prevent reordering of values during the binding

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