Skip to content

WebCmdlets: WebResponseObject.CoreClr.cs every get on Headers creates a new Dictionary #3842

@SteveL-MSFT

Description

@SteveL-MSFT

The Headers property creates a new Dictionary which then gets populated. Users typically do something like

if (obj.Headers.ContainsKey("Something"))
{
    obj.Headers["Something"] ...
}

which now instantiates a new Dictionary twice, we should optimize this code. consider using a ReadOnlyDictionary

Metadata

Metadata

Assignees

No one assigned

    Labels

    WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions