File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 55using System . IO ;
66using System . Linq ;
77using System . Reflection ;
8+ using System . Runtime . CompilerServices ;
89using System . Xml ;
910using Autodesk . DesignScript . Interfaces ;
1011using DesignScript . Builtin ;
@@ -1394,8 +1395,11 @@ void core_Dispose(ProtoCore.RuntimeCore sender)
13941395 }
13951396
13961397 /// <summary>
1397- /// This class compares two CLR objects. It is used in CLRObjectMap to
1398- /// avoid hash collision.
1398+ /// This class compares two CLR objects using reference equality. It is used in CLRObjectMap
1399+ /// to map CLR object instances to their marshaled StackValue representations. Uses
1400+ /// RuntimeHelpers.GetHashCode to get the object's identity hash code, which ensures
1401+ /// well-distributed hash codes even when objects have value-based hash codes that collide
1402+ /// (e.g., Point objects with identical coordinates).
13991403 /// </summary>
14001404 public class ReferenceEqualityComparer : IEqualityComparer < object >
14011405 {
@@ -1406,7 +1410,7 @@ bool IEqualityComparer<object>.Equals(object x, object y)
14061410
14071411 public int GetHashCode ( object obj )
14081412 {
1409- return obj . GetHashCode ( ) ;
1413+ return RuntimeHelpers . GetHashCode ( obj ) ;
14101414 }
14111415 }
14121416
You can’t perform that action at this time.
0 commit comments