Pembicara:
using System;
struct StructWithDoubleField
{
public double value;
}
class My {
static void Main() {
StructWithDoubleField s1;
s1.value = 0.0;
StructWithDoubleField s2;
s2.value = -0.0;
Console.WriteLine(s1.GetHashCode() == s2.GetHashCode() ? "PASSED" : "FAILED");
}
}
Implementasi default GetHashCode
untuk struct seharusnya throw new NotSupportedException("Tomato!");
:grin:
https://github.com/dotnet/coreclr/pull/13164 melewatkan kasus ini.
@jkotas apa proses untuk meminta port setidaknya bagian bidang object
dari perbaikan ke rilis tambalan? Mengingat bug hilir yang dilaporkan pelanggan seperti aspnet/Mvc#7673, sepertinya kami membutuhkan ini setidaknya di 2.0.x.
/cc @davidfowl @Eilon @Petermarcu
Komentar yang paling membantu
Implementasi default
GetHashCode
untuk struct seharusnyathrow new NotSupportedException("Tomato!");
:grin: