You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Analyzer] Lift arrays of literals to static fields #78398
We should consider adding an info-level analyzer that flags cases where arrays of literals are being allocated and recommend they instead be lifted to be stored in static readonly fields. We'll need to experiment a bit to drive down false positive rates, e.g.
Don't warn if the array is returned out of the method.
Don't warn if the array is mutated by the method.
Don't warn if the array is being stored / passed immediately as a ReadOnlySpan<T>.
Activity
buyaa-n commentedon Mar 12, 2024
Isn't it same as Extract array of const to static readonly field?
steveberdy commentedon Aug 31, 2024
This definitely looks the same to me
buyaa-n commentedon Sep 3, 2024
Yeah, doesn't see any difference, closing as duplicate