[ https://issues.apache.org/jira/browse/AVRO-3503?focusedWorklogId=782708&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-782708 ]
ASF GitHub Bot logged work on AVRO-3503: ---------------------------------------- Author: ASF GitHub Bot Created on: 19/Jun/22 15:09 Start Date: 19/Jun/22 15:09 Worklog Time Spent: 10m Work Description: 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)`. Issue Time Tracking ------------------- Worklog Id: (was: 782708) Time Spent: 1h 20m (was: 1h 10m) > C# Equals should not apply 'is' or 'as' > --------------------------------------- > > Key: AVRO-3503 > URL: https://issues.apache.org/jira/browse/AVRO-3503 > Project: Apache Avro > Issue Type: Bug > Components: csharp > Reporter: Kyle Schoonover > Priority: Major > Labels: pull-request-available > Time Spent: 1h 20m > Remaining Estimate: 0h > > References: > [Equals should not apply “is” — CodeQL query help documentation > (github.com)|https://codeql.github.com/codeql-query-help/csharp/cs-equals-uses-is/] > [Equals should not apply “as” — CodeQL query help documentation > (github.com)|https://codeql.github.com/codeql-query-help/csharp/cs-equals-uses-as/] > > This will not allow equals methods to work correctly when dealing with > inheritance. -- This message was sent by Atlassian Jira (v8.20.7#820007)