Code inspection: Type with suspicious equality is used in a record (non-private accessibility)
This inspection reports suspicious non-structurally comparable types being used in C# record member types. In the example below, instances of the Payload
record will be compared by having the same Header
string value and the same byte[]
array reference, which is very likely not how you want to compare byte arrays:
public class Test
{
public Test()
{
var cache = new Dictionary<Payload, ProcessingResult>();
}
}
public record Payload(string Header, int[] Bytes); // Warning
public record ProcessingResult;
Last modified: 24 July 2024