public int GetHashCode(FileName obj) { return(HashCode.Combine(RuntimeHelpers.GetHashCode(obj.Parent), RuntimeHelpers.GetHashCode(obj.Name))); }
public override int GetHashCode() { return(RuntimeHelpers.GetHashCode(FilterUIHint) ^ RuntimeHelpers.GetHashCode(PresentationLayer)); }
public int GetHashCode(object obj) => RuntimeHelpers.GetHashCode(obj);
public int GetHashCode(IRepository <TEntity, TId> obj) => obj is null ? 0 : RuntimeHelpers.GetHashCode(obj);
public override int GetHashCode(TItem obj) => RuntimeHelpers.GetHashCode(obj);
public int GetHashCode(T item) { return(RuntimeHelpers.GetHashCode(item)); }
public override int GetHashCode() => RuntimeHelpers.GetHashCode(this);
public override int GetHashCode() { return(RuntimeHelpers.GetHashCode(readerKey) * FieldName.GetHashCode()); }
int IEqualityComparer <object> .GetHashCode(object obj) { // put objects in a bucket based on their reference return(RuntimeHelpers.GetHashCode(obj)); }
public int GetHashCode(FlowKey obj) { return(RuntimeHelpers.GetHashCode(obj)); }
/// <summary> /// Tests a CacheEntry[] for indication of "insane" cache usage. /// <para> /// <b>NOTE:</b>FieldCache CreationPlaceholder objects are ignored. /// (:TODO: is this a bad idea? are we masking a real problem?) /// </para> /// </summary> public Insanity[] Check(params FieldCache.CacheEntry[] cacheEntries) { if (null == cacheEntries || 0 == cacheEntries.Length) { return(new Insanity[0]); } if (estimateRam) { for (int i = 0; i < cacheEntries.Length; i++) { cacheEntries[i].EstimateSize(); } } // the indirect mapping lets MapOfSet dedup identical valIds for us // maps the (valId) identityhashCode of cache values to // sets of CacheEntry instances MapOfSets <int, FieldCache.CacheEntry> valIdToItems = new MapOfSets <int, FieldCache.CacheEntry>(new Dictionary <int, ISet <FieldCache.CacheEntry> >(17)); // maps ReaderField keys to Sets of ValueIds MapOfSets <ReaderField, int> readerFieldToValIds = new MapOfSets <ReaderField, int>(new Dictionary <ReaderField, ISet <int> >(17)); // any keys that we know result in more then one valId ISet <ReaderField> valMismatchKeys = new JCG.HashSet <ReaderField>(); // iterate over all the cacheEntries to get the mappings we'll need for (int i = 0; i < cacheEntries.Length; i++) { FieldCache.CacheEntry item = cacheEntries[i]; object val = item.Value; // It's OK to have dup entries, where one is eg // float[] and the other is the Bits (from // getDocWithField()) if (val is IBits) { continue; } if (val is FieldCache.CreationPlaceholder) { continue; } ReaderField rf = new ReaderField(item.ReaderKey, item.FieldName); int valId = RuntimeHelpers.GetHashCode(val); // indirect mapping, so the MapOfSet will dedup identical valIds for us valIdToItems.Put(valId, item); if (1 < readerFieldToValIds.Put(rf, valId)) { valMismatchKeys.Add(rf); } } List <Insanity> insanity = new List <Insanity>(valMismatchKeys.Count * 3); insanity.AddRange(CheckValueMismatch(valIdToItems, readerFieldToValIds, valMismatchKeys)); insanity.AddRange(CheckSubreaders(valIdToItems, readerFieldToValIds)); return(insanity.ToArray()); }
public IdentityWeakReference(T target) : base(target == null ? NULL : target) { hash = RuntimeHelpers.GetHashCode(target); }
public void NoIdReturnsBaseHashCode() { var bar = new EntityWithGuidPrimaryKey(); Assert.Equal(RuntimeHelpers.GetHashCode(bar), bar.GetHashCode()); }
public int GetHashCode(Vessel foo) { return(RuntimeHelpers.GetHashCode(foo)); }
/// <summary> /// Returns hash code for the this list. /// </summary> /// <returns>The hash code of this list.</returns> public override int GetHashCode() => source is null || mapper is null ? 0 : RuntimeHelpers.GetHashCode(source) ^ mapper.GetHashCode();
private object CloneInstance(object source) { if (source == null) { return(null); } object target; // check if this object has already been cloned // using RuntimeHelpers.GetHashCode to get object identity int hashCode = RuntimeHelpers.GetHashCode(source); if (_objectReferences.TryGetValue(hashCode, out target)) { return(target); } #if !SILVERLIGHT // using ICloneable if available var cloneable = source as ICloneable; if (cloneable != null) { target = cloneable.Clone(); // keep track of cloned instances _objectReferences.Add(hashCode, target); return(target); } #endif var sourceType = source.GetType(); var sourceAccessor = TypeAccessor.GetAccessor(sourceType); target = sourceAccessor.Create(); // keep track of cloned instances _objectReferences.Add(hashCode, target); var sourceProperties = sourceAccessor.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (IMemberAccessor sourceProperty in sourceProperties) { if (!sourceProperty.HasGetter) { continue; } var originalValue = sourceProperty.GetValue(source); if (originalValue == null) { continue; } var propertyType = sourceProperty.MemberType.GetUnderlyingType(); var interfaces = propertyType.GetInterfaces(); if (propertyType.IsArray) { CloneArray(sourceProperty, source, target); } else if (originalValue is IDictionary) { CloneDictionary(sourceProperty, originalValue, target); } else if (interfaces.Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IDictionary <,>))) { CloneGenericDictionary(sourceProperty, originalValue, target); } else if (originalValue is IList) { CloneCollection(sourceProperty, originalValue, target); } else if (interfaces.Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IList <>))) { CloneGenericCollection(sourceProperty, originalValue, target); } else if (!propertyType.IsValueType && propertyType != typeof(string)) { CloneObject(sourceProperty, originalValue, target); } else if (sourceProperty.HasSetter) { sourceProperty.SetValue(target, originalValue); } } return(target); }
public int GetHashCode(IValidator obj) { return(RuntimeHelpers.GetHashCode(obj)); }
public static long identityHash(this Object clrObject) { return(RuntimeHelpers.GetHashCode(clrObject)); }
public int GetHashCode(T value) { return(RuntimeHelpers.GetHashCode(value)); }
public static int GetHashCode(object a) { return(RuntimeHelpers.GetHashCode(a)); }
public override int GetHashCode(E obj) { return(RuntimeHelpers.GetHashCode(obj)); }
// GetHashCode is intended to serve as a hash function for this object. // Based on the contents of the object, the hash function will return a suitable // value with a relatively random distribution over the various inputs. // // The default implementation returns the sync block index for this instance. // Calling it on the same object multiple times will return the same value, so // it will technically meet the needs of a hash function, but it's less than ideal. // Objects (& especially value classes) should override this method. // public virtual int GetHashCode() { return(RuntimeHelpers.GetHashCode(this)); }
public int GetHashCode(T x) { return(RuntimeHelpers.GetHashCode(x)); }
// Use reference equality because there's only one EmptySelection per text area. public override int GetHashCode() { return(RuntimeHelpers.GetHashCode(this)); }
public override int GetHashCode() { return(Hash.Combine(RuntimeHelpers.GetHashCode(Definition), StartLine.GetHashCode())); }
public override int GetHashCode() { return(RuntimeHelpers.GetHashCode(Instance)); }
public int GetHashCode(object obj) { return(RuntimeHelpers.GetHashCode(obj)); }
public int GetHashCode(T value) => value is null ? 0 : RuntimeHelpers.GetHashCode(value);
// Token: 0x06003426 RID: 13350 RVA: 0x0012F883 File Offset: 0x0012DC83 int IEqualityComparer <object> .GetHashCode(object obj) { return(RuntimeHelpers.GetHashCode(obj)); }
// <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() { return(RuntimeHelpers.GetHashCode(_entity)); }