Changeset 1702
- Timestamp:
- 04/29/09 14:34:19 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs
r1701 r1702 9 9 using System.Runtime.InteropServices; 10 10 11 namespace HeuristicLab.Persistence.Core { 12 13 public class ReferenceEqualityComparer : IEqualityComparer<object> { 14 15 public bool Equals(object a, object b) { 16 return Object.ReferenceEquals(a, b); 17 } 18 19 public int GetHashCode(object obj) { 20 GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Weak); 21 int address = GCHandle.ToIntPtr(handle).ToInt32(); 22 handle.Free(); 23 return address; 24 } 25 26 } 11 namespace HeuristicLab.Persistence.Core { 27 12 28 13 public class Serializer : IEnumerable<ISerializationToken> { 14 15 class ReferenceEqualityComparer : IEqualityComparer<object> { 16 17 public bool Equals(object a, object b) { 18 return Object.ReferenceEquals(a, b); 19 } 20 21 public int GetHashCode(object obj) { 22 GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Weak); 23 int address = GCHandle.ToIntPtr(handle).ToInt32(); 24 handle.Free(); 25 return address; 26 } 27 28 } 29 29 30 30 private readonly object obj;
Note: See TracChangeset
for help on using the changeset viewer.