Skip to content

Is it possible to describe "typical" performance degradations of using abstract types, like IReadOnlyDictionary<T,T> over Dictionary<T,T> #38279

@taylorchasewhite

Description

@taylorchasewhite

Type of issue

Missing information

Description

I appreciate the code analysis warnings introduced in .NET 8, but I'm struggling with this one. In general, my firm likes to enforce read-only usage of collections, via IReadOnlyList and IReadOnlyDictionary, and obviously this warning conflicts with that objective. It would be helpful to many folks getting this warning to understand the extent of the performance degradation from using an interface declaration vs. a concrete type declaration, even if the description of that degradation is very brief and broad (e.g. it's on average 10% slower, or 50% slower to call the virtual method).

Page URL

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1859

Content source URL

https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/quality-rules/ca1859.md

Document Version Independent Id

c8f7f102-2398-9acc-71b8-b0f848a05b92

Article author

gewarren

Metadata

  • ID: 0e2d460f-c6f3-1e26-d932-b7e69746e513
  • Service: dotnet-fundamentals

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions