You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2022/06/19 15:09:09 UTC

[GitHub] [avro] KalleOlaviNiemitalo commented on pull request #1666: AVRO-3503 Fix usage of 'is' and 'as' in Equals

KalleOlaviNiemitalo commented on PR #1666:
URL: https://github.com/apache/avro/pull/1666#issuecomment-1159751276

   In general, I'd recommend having A.Equals(object obj) compare `obj.GetType() == this.GetType()` rather than `obj.GetType() == typeof(A)`. This way, if another class B is derived from A, then B.Equals(object obj) can call base.Equals(obj) to compare the types and the members inherited from A.  If A is a struct or a sealed class, then the JIT compiler should be able to optimize `this.GetType()` to `typeof(A)`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org