I have a class that has these 2 fields:
private readonly Memory<byte> data;
public Memory<byte> Reserved1 => data.Slice(0, 2);
ReSharper is giving me a warning with the Slice
: Impure method is called for readonly field of value type
Removing readonly
from the data declaration fixes the warning, but I'd like to understand if this warning is a false positive in this situation or if the warning is valid and I should avoid setting data
readonly
. Any advice?