File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
MetadataProcessor.Shared/Utility Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -79,13 +79,17 @@ public int GetHashCode(TypeReference obj)
7979 // provide an hash code based on the TypeSpec signature
8080 return xSignatureId ;
8181 }
82- else if ( obj is GenericParameter )
82+ else if ( obj is GenericParameter genericParam )
8383 {
8484 // provide an hash code based on the generic parameter position and type,
8585 // which is what makes it unique when comparing GenericParameter as a TypeReference
86- var genericParam = obj as GenericParameter ;
8786
88- return genericParam . Position * 10 + ( int ) genericParam . Type ;
87+ int hash = 17 ;
88+ hash = unchecked ( hash * 31 + genericParam . DeclaringType ? . MetadataToken . ToInt32 ( ) ?? 0 ) ;
89+ hash = unchecked ( hash * 31 + genericParam . Position ) ;
90+ hash = unchecked ( hash * 31 + ( int ) genericParam . Type ) ;
91+
92+ return hash ;
8993 }
9094 else
9195 {
You can’t perform that action at this time.
0 commit comments