Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1707


Ignore:
Timestamp:
04/29/09 16:33:33 (16 years ago)
Author:
epitzer
Message:

Use actual GetHashCode instead of garbage collector handle for less speed but more safety. (#605)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs

    r1703 r1707  
    88using HeuristicLab.Persistence.Default.Decomposers.Storable;
    99using System.Text;
    10 using System.Runtime.InteropServices;
    1110
    1211namespace HeuristicLab.Persistence.Core {
     
    2120
    2221      public int GetHashCode(object obj) {
    23         GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Weak);
    24         int address = GCHandle.ToIntPtr(handle).ToInt32();
    25         handle.Free();
    26         return address;
     22        return obj.GetHashCode();
    2723      }
    2824
Note: See TracChangeset for help on using the changeset viewer.