File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
src/Confluent.SchemaRegistry/Rest/DataContracts Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -271,12 +271,37 @@ public override int GetHashCode()
271
271
unchecked
272
272
{
273
273
var hashCode = SchemaString . GetHashCode ( ) ;
274
- hashCode = ( hashCode * 397 ) ^ ( References != null ? References . GetHashCode ( ) : 0 ) ;
274
+ hashCode = ( hashCode * 397 ) ^ ( References != null ? GetListHashCode ( References ) : 0 ) ;
275
275
hashCode = ( hashCode * 397 ) ^ ( Metadata != null ? Metadata . GetHashCode ( ) : 0 ) ;
276
276
hashCode = ( hashCode * 397 ) ^ ( RuleSet != null ? RuleSet . GetHashCode ( ) : 0 ) ;
277
277
return hashCode ;
278
278
}
279
279
}
280
+
281
+ /// <summary>
282
+ /// Returns a hash code for a list of objects.
283
+ /// </summary>
284
+ /// <param name="list">
285
+ /// The list to get the hash code for.
286
+ /// </param>
287
+ /// <returns>
288
+ /// An integer that specifies a hash value for this instance.
289
+ /// </returns>
290
+ private int GetListHashCode < T > ( IList < T > list )
291
+ {
292
+ if ( list == null || list . Count == 0 )
293
+ return 0 ;
294
+
295
+ unchecked
296
+ {
297
+ int hash = 0 ;
298
+ foreach ( var item in list )
299
+ {
300
+ hash += item ? . GetHashCode ( ) ?? 0 ;
301
+ }
302
+ return hash ;
303
+ }
304
+ }
280
305
281
306
/// <summary>
282
307
/// Compares this instance with another instance of this object type and indicates whether
You can’t perform that action at this time.
0 commit comments