public override int GetHashCode() { // TODO: review return(ClassName.GetHashCode() ^ MethodName.GetHashCode() ^ Parameters.Count); }
public override int GetHashCode() { unchecked { return((MethodName.GetHashCode() * 397) ^ Parameters.GetHashCode()); } }
public MethodCacheObject(IMethodInvocation methodInvocation) { var cache = (Cached)methodInvocation.MethodInfo.GetCustomAttributes(typeof(Cached), false).First(); MethodName = $"{methodInvocation.MethodInfo.ReflectedType}.{methodInvocation.MethodInfo.Name}"; ResultType = methodInvocation.MethodInfo.ReturnType; var args = methodInvocation.Arguments.Count > 0 ? methodInvocation.Arguments.Select(arg => arg.Value.GetHashCode()).Aggregate((val1, val2) => val1 * 397 ^ val2) : 0; Key = ((args ^ MethodName.GetHashCode()) * 397).ToString(); var invalidationKeys = methodInvocation.Arguments.Where(arg => arg.Value is ICachedRessource); if (invalidationKeys.Any()) { var keys = invalidationKeys .Select(key => key.Value) .Cast <ICachedRessource>() .Select(key => key.GetCacheInvalidationTags()) .Aggregate((tags1, tags2) => { return(tags1.Concat(tags2)); }).Distinct(); Key = $"{keys.Aggregate((str1, str2) => str1 + "_" + str2)}-{Key}"; } }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object" />. /// </returns> public override Int32 GetHashCode() { unchecked { return(((MethodName != null ? MethodName.GetHashCode() : 0) * 397) ^ (ActualParameters != null ? ActualParameters.GetHashCode() : 0)); } }
public override int GetHashCode() { unchecked { return((Reference.GetHashCode() * 91747) ^ MethodName.GetHashCode()); } }
public override int GetHashCode() { return (FullInterfaceName.GetHashCode() + MethodName.GetHashCode() + Params.Sum(x => x?.GetHashCode() ?? 0)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (MethodName != null) { hashCode = hashCode * 59 + MethodName.GetHashCode(); } if (Payload != null) { hashCode = hashCode * 59 + Payload.GetHashCode(); } if (ResponseTimeoutInSeconds != null) { hashCode = hashCode * 59 + ResponseTimeoutInSeconds.GetHashCode(); } if (ConnectTimeoutInSeconds != null) { hashCode = hashCode * 59 + ConnectTimeoutInSeconds.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { unchecked { var result = (TypeName.FullName != null ? TypeName.FullName.GetHashCode() : 0); result = (result * 397) ^ (Id != null ? Id.GetHashCode() : 0); result = (result * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0); return(result); } }
public override int GetHashCode() { unchecked { var hashCode = TypeName?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (MethodName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ParameterTypes?.Length.GetHashCode() ?? 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = 11 + Reference.GetHashCode(); hashCode = (hashCode * 397) ^ MethodName.GetHashCode(); hashCode = (hashCode * 397) ^ Parameters.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = (AssemblyName != null ? AssemblyName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (NameSpace != null ? NameSpace.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ClassName != null ? ClassName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = (ClassName != null ? ClassName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FileName != null ? FileName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ LineNumber; return(hashCode); } }
public override int GetHashCode() { int hash = 0; hash += 11 * MethodName.GetHashCode() + 13; foreach (var type in ParameterTypes) { hash += 11 * type.GetHashCode() + 13; } return(hash); }
public override int GetHashCode() { unchecked { // Don't call base.GetHashCode so that we don't try to include Id or ParentId, // which are different per-instance and we're trying to behave like a value type int result = explicitly.GetHashCode(); result = (result * 397) ^ (TypeName != null ? TypeName.GetHashCode() : 0); result = (result * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0); result = (result * 397) ^ (ProjectId != null ? ProjectId.GetHashCode() : 0); return(result); } }
public override int GetHashCode() { if (_intHashCode == -1) { _intHashCode = Type.GetHashCode() ^ MethodName.GetHashCode(); foreach (Type objType in ArgumentTypes) { _intHashCode ^= objType.FullName.GetHashCode(); } } return(_intHashCode); }
public override int GetHashCode() { unchecked { var hashCode = Location.GetHashCode(); hashCode = (hashCode * 397) ^ MethodName.GetHashCode(); hashCode = (hashCode * 397) ^ TextRange.GetHashCode(); hashCode = (hashCode * 397) ^ (int)Mode; hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0); hashCode = (hashCode * 397) ^ TargetScriptReference.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { // Don't include base.GetHashCode, as RemoteTask.GetHashCode includes RemoteTask.Id // in the calculation, and this is a new guid generated for each new instance. // This would mean two instances that return true from Equals (i.e. value objects) // would have different hash codes int result = (TypeName != null ? TypeName.GetHashCode() : 0); result = (result * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0); result = (result * 397) ^ (AssemblyLocation != null ? AssemblyLocation.GetHashCode() : 0); return(result); } }
public override int GetHashCode() { unchecked { var hashCode = OwnerName.GetHashCode(); hashCode = (hashCode * 397) ^ MethodName.GetHashCode(); hashCode = (hashCode * 397) ^ (int)Mode; hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0); hashCode = (hashCode * 397) ^ TargetScriptReference.GetHashCode(); hashCode = (hashCode * 397) ^ TextRangeOwnerPsiPersistentIndex.GetHashCode(); hashCode = (hashCode * 397) ^ TextRangeOwner.GetHashCode(); return(hashCode); } }
/// <summary> /// Provides a representative hash code for objects of this type to spread out distribution /// in hash tables. /// </summary> /// <remarks>Objects which consider themselves to be Equal (a.Equals(b) returns true) are /// expected to have the same hash code. Objects which are not Equal may have the same /// hash code, but minimizing such overlaps helps with efficient operation of hash tables. /// </remarks> /// <returns> /// an int representing the hash code calculated for the contents of this object /// </returns> public override int GetHashCode() { int myHash = base.GetHashCode(); // Fold in hash code for inherited base type myHash ^= (int)Severity; // Fold in Severity (enum) as an int as its own hash code myHash ^= Id.GetHashCode(); // Fold in hash code for GUID if (Caption != null) { myHash ^= Caption.GetHashCode(); // Fold in hash code for string Caption } if (Description != null) { myHash ^= Description.GetHashCode(); // Fold in hash code for string Caption } if (Details != null) { myHash ^= Details.GetHashCode(); // Fold in hash code for string Caption } if (LogSystem != null) { myHash ^= LogSystem.GetHashCode(); // Fold in hash code for string LogSystem } if (CategoryName != null) { myHash ^= CategoryName.GetHashCode(); // Fold in hash code for string CategoryName } if (UserName != null) { myHash ^= UserName.GetHashCode(); // Fold in hash code for string UserName } if (MethodName != null) { myHash ^= MethodName.GetHashCode(); // Fold in hash code for string MethodName } if (ClassName != null) { myHash ^= ClassName.GetHashCode(); // Fold in hash code for string ClassName } if (FileName != null) { myHash ^= FileName.GetHashCode(); // Fold in hash code for string FileName } myHash ^= LineNumber; // Fold in LineNumber int as its own hash code myHash ^= ThreadId; // Fold in ThreadId int as its own hash code // Session member is not used in Equals, so we can't use it in hash calculation! return(myHash); }
public override int GetHashCode() { int hash = 1; if (MethodName.Length != 0) { hash ^= MethodName.GetHashCode(); } hash ^= fees_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { unchecked { // Don't include base.GetHashCode, as RemoteTask.GetHashCode includes RemoteTask.Id // in the calculation, and this is a new guid generated for each new instance. // This would mean two instances that return true from Equals (i.e. value objects) // would have different hash codes var result = ProjectId.GetHashCode(); result = (result * 397) ^ TypeName.GetHashCode(); result = (result * 397) ^ MethodName.GetHashCode(); result = (result * 397) ^ TheoryName.GetHashCode(); return(result); } }
/// <inheritdoc /> public override int GetHashCode() { #if NET462 || NETSTANDARD2_0 unchecked { var hashCode = (ClassName != null ? ClassName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FileName != null ? FileName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ LineNumber; return(hashCode); } #endif #if NETSTANDARD2_1 return(HashCode.Combine(ClassName, MethodName, FileName, LineNumber)); #endif }
public override int GetHashCode() { int hash = 1; if (ServiceName.Length != 0) { hash ^= ServiceName.GetHashCode(); } if (MethodName.Length != 0) { hash ^= MethodName.GetHashCode(); } if (RequestId != 0) { hash ^= RequestId.GetHashCode(); } if (Payload.Length != 0) { hash ^= Payload.GetHashCode(); } return(hash); }
/// <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() { // As obtained from the Jon Skeet answer to: // http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode // And adapted towards the Modified Bernstein (shown here: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx) // // Overflow is fine, just wrap unchecked { // Pick a random prime number int hash = 17; // Mash the hash together with yet another random prime number hash = (hash * 23) ^ DeclaringType.GetHashCode(); hash = (hash * 23) ^ MethodName.GetHashCode(); foreach (var parameter in Parameters) { hash = (hash * 23) ^ parameter.GetHashCode(); } return(hash); } }
public override int GetHashCode() { return(MethodName.GetHashCode() + 11 * Parameters.Count.GetHashCode()); }
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { return(MethodName.GetHashCode()); }
public override int GetHashCode() { int hash = 1; if (ServiceName.Length != 0) { hash ^= ServiceName.GetHashCode(); } if (MethodName.Length != 0) { hash ^= MethodName.GetHashCode(); } if (FixedCallCost != 0) { hash ^= FixedCallCost.GetHashCode(); } if (FixedPacketSize != 0) { hash ^= FixedPacketSize.GetHashCode(); } if (VariableMultiplier != 0F) { hash ^= VariableMultiplier.GetHashCode(); } if (Multiplier != 0F) { hash ^= Multiplier.GetHashCode(); } if (RateLimitCount != 0) { hash ^= RateLimitCount.GetHashCode(); } if (RateLimitSeconds != 0) { hash ^= RateLimitSeconds.GetHashCode(); } if (MaxPacketSize != 0) { hash ^= MaxPacketSize.GetHashCode(); } if (MaxEncodedSize != 0) { hash ^= MaxEncodedSize.GetHashCode(); } if (Timeout != 0F) { hash ^= Timeout.GetHashCode(); } if (CapBalance != 0) { hash ^= CapBalance.GetHashCode(); } if (IncomePerSecond != 0F) { hash ^= IncomePerSecond.GetHashCode(); } if (ServiceHash != 0) { hash ^= ServiceHash.GetHashCode(); } if (MethodId != 0) { hash ^= MethodId.GetHashCode(); } return(hash); }
public override int GetHashCode() { return(MessageType != null?MethodName.GetHashCode() ^ MessageType.GetHashCode() : MethodName.GetHashCode()); }
public override int GetHashCode() { return(AssemblyName.GetHashCode() * 100 + TypeName.GetHashCode() * 10 + MethodName.GetHashCode()); }
public override int GetHashCode() { return(ArgumentsHashCode() ^ MethodName.GetHashCode() ^ RetType.GetHashCode() ^ Access.GetHashCode()); }