Code inspection: Type with suspicious equality is used in a record (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>();
}
record Payload(string Header, int[] Bytes); // Warning
record ProcessingResult;
}
Last modified: 08 August 2024