How to determine if two generic type values are equal?

前端 未结 7 2220
忘掉有多难
忘掉有多难 2021-02-08 13:29

Update* I am so sorry... my sample code contained an error which resulted in a lot of answers I didn\'t understand. In stead of

Console.WriteLin         


        
7条回答
  •  南笙
    南笙 (楼主)
    2021-02-08 14:05

    To elaborate on Gideon's answer (please upvote his, not mine): the method you defined has signature

    bool GenericOjbect::Equals( T )
    

    While your code is calling

    bool GenericOjbect::Equals( GenericOjbect )
    

    which is inherited (not overridden) from Object.

提交回复
热议问题