Given:
C#public struct MyStruct
{
public MyStruct(string name)
{
this.Name = name;
}
public string Name { get; }
}
The implementation should not generate code like:
C#public static bool operator ==(MyStruct first, MyStruct second)
{
if ((object)first == null)
return (object)second == null;
return first.Equals(second);
}
public bool Equals(ExitPointTarget other)
{
if (ReferenceEquals(null, other))
return false;
if (ReferenceEquals(this, other))
return true;
return Equals(this.Name, other.Name);
}
The correct implementation should be:
C#public static bool operator ==(MyStruct first, MyStruct second)
{
return first.Equals(second);
}
public bool Equals(ExitPointTarget other)
{
return Equals(this.Name, other.Name);
}
Hello Paulo,
Thank you for pointing out this issue and providing a code sample.
We agree with you that we shouldn't do nullability or reference equality checks for structures.
We will change this behavior and notify you as soon as we do this.