Comparing two structs using ==

前端 未结 6 851
萌比男神i
萌比男神i 2020-12-11 00:29

I am trying to compare two structs using equals (==) in C#. My struct is below:

public struct CisSettings : IEquatable
{
    public int Ga         


        
6条回答
  •  心在旅途
    2020-12-11 00:40

    When you override the .Equals method, the == operator isn't automatically overloaded. You need to do that explicitly.

    See also Guidelines for Overriding Equals() and Operator ==.

提交回复
热议问题