Beispiel #1
0
            // private GCHandle _gcHandle;

            public WeakKey(TKey key)
                : base(key, true)
            {
                _hashCode = key.GetHashCode();
                // Keep the key alive until it is explicitly collected
                // _gcHandle = GCHandle.Alloc(this);
            }
Beispiel #2
0
 public Node(TKey key, TValue value)
 {
     this.key   = key;
     this.value = value;
     hash       = key.GetHashCode();
     next       = null;
 }
Beispiel #3
0
            // Constructors

            public WeakEntry(TKey key, TItem item, bool trackKeyResurrection, bool trackItemResurrection)
            {
                keyHandle = GCHandle.Alloc(key,
                                           trackKeyResurrection ? GCHandleType.WeakTrackResurrection : GCHandleType.Weak);
                itemHandle = GCHandle.Alloc(item,
                                            trackItemResurrection ? GCHandleType.WeakTrackResurrection : GCHandleType.Weak);
                hashCode = key.GetHashCode();
            }
Beispiel #4
0
 int GetIndex(TKey key)
 {
     if (key is null)
     {
         throw new ArgumentNullException("key is null");
     }
     return((key.GetHashCode() % Capacity + Capacity) % Capacity);
 }
Beispiel #5
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 31 + Key.GetHashCode();
         hash = hash * 31 + Time.GetHashCode();
         return(hash);
     }
 }
Beispiel #6
0
            public override int GetHashCode()
            {
                int num;

                if (key != null)
                {
                    TKey val = key;
                    num = val.GetHashCode();
                }
                else
                {
                    num = 0;
                }
                return(num ^ ((evalue != null) ? evalue.GetHashCode() : 0));
            }
Beispiel #7
0
            public Optional <KeyValuePair <TKey, TValue> > Root_FindKvp(TKey key)
            {
                var hash = key.GetHashCode();

                return(FindKvp(hash, key));
            }
Beispiel #8
0
            public Optional <TValue> Root_Find(TKey key)
            {
                var hash = key.GetHashCode();

                return(Find(hash, key));
            }
Beispiel #9
0
 public override int GetHashCode()
 {
     return(key.GetHashCode());
 }
 public Reference(TKey obj)
 {
     this.hashCode = obj.GetHashCode();
     WeakReference = new WeakReference(obj);
 }
Beispiel #11
0
 public override int GetHashCode()
 {
     return((key == null ? 0 : key.GetHashCode()) ^ (evalue == null ? 0 : evalue.GetHashCode()));
 }
Beispiel #12
0
 public WeakKeyReference(TKey key)
     : base(key)
 {
     HashCode = key == null ? 0 : key.GetHashCode();
 }
Beispiel #13
0
 public override int GetHashCode()
 => (HashCode << 8) ^ Next ^ Key.GetHashCode() ^ (Value?.GetHashCode() ?? 0);
Beispiel #14
0
 public override int GetHashCode()
 {
     return((HashCode << 8) ^ Next ^ Key.GetHashCode() ^ Value.GetHashCode());
 }
Beispiel #15
0
 public override int GetHashCode()
 {
     return (key == null ? 0 : key.GetHashCode()) ^
            (val == null ? 0 : val.GetHashCode());
 }