Closed teo-tsirpanis closed 1 year ago
Note to self: works for byte-sized enums as well
using System;
public class C {
public int M() {
ReadOnlySpan<E> xs = new E[] { }; // empty span
ReadOnlySpan<E> ys = new E[] { E.A };
ReadOnlySpan<E> zs = new E[] { E.A, E.A, E.A };
return xs.Length + ys.Length + zs.Length;
}
}
enum E : byte { A }
Thanks for reporting! Fix will be available in the next plugin release
See https://github.com/dotnet/roslyn/pull/24621. The plugin currently displays an allocation on the
new
keyword: