Comparing 2 custom objects - C#

前端 未结 6 1496
鱼传尺愫
鱼传尺愫 2021-01-05 11:48

I need to write a generic method in the base class that would accept 2 objects as parameters and compares them for equality.

Ex:

public abstract cla         


        
6条回答
  •  余生分开走
    2021-01-05 12:24

    Don't do it. Inheritance is the way to go and each class, should override the Equal and GetHashCode where needed.

    Maybe you'll get some work done out of those developers now but I'll come back to bite you in the ass in the future when the product needs to be maintained.

    Seriously, just try to find another way to help.

提交回复
热议问题