System.Type.GetHashCode()

Here are the examples of the csharp api System.Type.GetHashCode() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

533 Examples 7

19 View Source File : Notification.cs
License : GNU General Public License v3.0
Project Creator : BramDC3

public override int GetHashCode()
            {
                return typeof(T).GetHashCode() ^ 8510;
            }

19 View Source File : SubscriptionDataConfig.cs
License : Apache License 2.0
Project Creator : Capnode

public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = _sid.GetHashCode();
                hashCode = (hashCode*397) ^ Type.GetHashCode();
                hashCode = (hashCode*397) ^ (int) TickType;
                hashCode = (hashCode*397) ^ (int) Resolution;
                hashCode = (hashCode*397) ^ FillDataForward.GetHashCode();
                hashCode = (hashCode*397) ^ ExtendedMarketHours.GetHashCode();
                hashCode = (hashCode*397) ^ IsInternalFeed.GetHashCode();
                hashCode = (hashCode*397) ^ IsCustomData.GetHashCode();
                hashCode = (hashCode*397) ^ DataTimeZone.Id.GetHashCode();// timezone hash is expensive, use id instead
                hashCode = (hashCode*397) ^ ExchangeTimeZone.Id.GetHashCode();// timezone hash is expensive, use id instead
                hashCode = (hashCode*397) ^ IsFilteredSubscription.GetHashCode();
                return hashCode;
            }
        }

19 View Source File : TypeImplementation.cs
License : MIT License
Project Creator : apexsharp

public int hashCode() => Type.GetHashCode();

19 View Source File : System_TypeWrap.cs
License : MIT License
Project Creator : bjfumac

[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetHashCode(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			System.Type obj = ToLua.CheckMonoType(L, 1);
			int o = obj.GetHashCode();
			LuaDLL.lua_pushinteger(L, o);
			return 1;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

19 View Source File : SemanticContext.cs
License : MIT License
Project Creator : Azure

public override int GetHashCode()
            {
                return MurmurHash.HashCode(opnds, typeof(SemanticContext.AND).GetHashCode());
            }

19 View Source File : Entity.cs
License : MIT License
Project Creator : Andyhacool

public override int GetHashCode()
        {
            return (GetType().GetHashCode() * 907) + Id.GetHashCode();
        }

19 View Source File : TypePair.cs
License : Apache License 2.0
Project Creator : busterwood

public override int GetHashCode() => From == null ? 0 : From.GetHashCode() + To.GetHashCode() + MissingMethods.GetHashCode();

19 View Source File : Uncapsulator.cs
License : MIT License
Project Creator : albahari

public override int GetHashCode () => Type.GetHashCode () + 37 * Name.GetHashCode ();

19 View Source File : VRTK_SDKInfo.cs
License : MIT License
Project Creator : charles-river-analytics

public override int GetHashCode()
        {
            return type.GetHashCode();
        }

19 View Source File : GraphCommand.cs
License : MIT License
Project Creator : alelievr

public override int GetHashCode()
		{
			return position.GetHashCode()
				+ type.GetHashCode()
				+ forcePositon.GetHashCode()
				+ name.GetHashCode()
				+ nodeType.GetHashCode()
				+ fromNodeName.GetHashCode()
				+ toNodeName.GetHashCode();
		}

19 View Source File : DynamicInvoker.cs
License : MIT License
Project Creator : binarymash

private static int Hash(Type type, string methodname, object[] args)
        {
            var hash = 23;
            hash = (hash * 31) + type.GetHashCode();
            hash = (hash * 31) + methodname.GetHashCode();
            for (var index = 0; index < args.Length; index++)
            {
                var argtype = args[index].GetType();
                hash = (hash * 31) + argtype.GetHashCode();
            }

            return hash;
        }

19 View Source File : TypeEqualityComparer.cs
License : GNU Lesser General Public License v3.0
Project Creator : Barsonax

public int GetHashCode(T obj)
        {
            return obj.GetType().GetHashCode();
        }

19 View Source File : TypeCachingKey.cs
License : MIT License
Project Creator : aloneguid

public override int GetHashCode()
      {
         return 31 * ClreplacedType.GetHashCode() + Field.GetHashCode();
      }

19 View Source File : TypeComparer.cs
License : GNU General Public License v3.0
Project Creator : blqw

public int GetHashCode(Type obj)
        {
            if (obj != null && obj.GetType() != _runtimeType && obj.IsGenericType)
            {
                var hashcode = obj.GetGenericTypeDefinition().GetHashCode();
                if (!obj.IsGenericTypeDefinition)
                {
                    foreach (var item in obj.GetGenericArguments())
                    {
                        hashcode ^= item.GetHashCode();
                    }
                }
                return hashcode;
            }
            return obj?.GetHashCode() ?? 0;
        }

19 View Source File : DefaultContractResolver.cs
License : MIT License
Project Creator : akaskela

public override int GetHashCode()
        {
            return _resolverType.GetHashCode() ^ _contractType.GetHashCode();
        }

19 View Source File : ObjectMapper.cs
License : Apache License 2.0
Project Creator : busterwood

public override int GetHashCode()
        {
            unchecked
            {
                return (In.GetHashCode() * 397) ^ Out.GetHashCode();
            }
        }

19 View Source File : Entity.cs
License : Apache License 2.0
Project Creator : aneshas

public override int GetHashCode()
        {
            if (Id.Equals(default(TIdenreplacedy)))
            {
                return base.GetHashCode();
            }

            return GetType().GetHashCode() ^ Id.GetHashCode();
        }

19 View Source File : SemanticContext.cs
License : MIT License
Project Creator : Butjok

public override int GetHashCode()
            {
                return MurmurHash.HashCode(opnds, typeof(SemanticContext.OR).GetHashCode());
            }

19 View Source File : VssConnection.cs
License : MIT License
Project Creator : actions

public int GetHashCode(ClientCacheKey obj)
                {
                    return obj.Type.GetHashCode() ^ obj.ServiceIdentifier.GetHashCode();
                }

19 View Source File : EasyProxyGenerator.cs
License : MIT License
Project Creator : ch00486259

private static Type CreateProxyType()
        {
            var interfaceType = InterfaceType;
            var typeName = string.Format("{0}_{1}_Imp_{2}", typeof(EasyProxyGenerator<T>).Name, interfaceType.Name, interfaceType.GetHashCode());

            TypeBuilder typeBuilder = ModuleBuilder.DefineType(typeName, TypeAttributes.Public | TypeAttributes.Clreplaced | TypeAttributes.Sealed, typeof(ProxyBase));
            typeBuilder.AddInterfaceImplementation(interfaceType);

            MethodInfo interceptMethodInfo = typeof(IInterceptor).GetMethod("Proceed", BindingFlags.Instance | BindingFlags.Public);
            FieldBuilder fieldBuilder = DynamicProxyHelper.DefineField(typeBuilder, "interceptor", typeof(IInterceptor), FieldAttributes.Private);

            DynamicProxyHelper.DefineConstructor(typeBuilder, fieldBuilder);
            DynamicProxyHelper.DefineMethods(typeBuilder, fieldBuilder, interfaceType, interceptMethodInfo);

            return typeBuilder.CreateTypeInfo().AsType();
        }

19 View Source File : TargetedType.cs
License : MIT License
Project Creator : azist

public override int GetHashCode() => Type.GetHashCode();

19 View Source File : ServiceClientHub.Inner.cs
License : MIT License
Project Creator : azist

public override int GetHashCode()
      {
        return m_Contract.GetHashCode();
      }

19 View Source File : CrmOnlineOrganizationService.cs
License : MIT License
Project Creator : Adoxio

protected virtual bool IsReadRequest(object request)
		{
			return request != null && Array.BinarySearch(_cachedRequestsSorted, request.GetType().GetHashCode()) >= 0;
		}

19 View Source File : SemanticContext.cs
License : MIT License
Project Creator : Azure

public override int GetHashCode()
            {
                return MurmurHash.HashCode(opnds, typeof(SemanticContext.OR).GetHashCode());
            }

19 View Source File : Entity.cs
License : MIT License
Project Creator : alexandrebeato

public override int GetHashCode()
        {
            return (GetType().GetHashCode() * 451) + Id.GetHashCode();
        }

19 View Source File : TemplateDefinition.cs
License : MIT License
Project Creator : beakona

public override int GetHashCode()
        {
            return this.GetType().GetHashCode() + this.Language.GetHashCode() + this.Body.GetHashCode();
        }

19 View Source File : SerializableSystemType.cs
License : MIT License
Project Creator : Baste-RainGames

public override int GetHashCode()
        {
            return SystemType.GetHashCode();
        }

19 View Source File : ThreadsafeTypeKeyHashTable.cs
License : Apache License 2.0
Project Creator : allenai

[MethodImpl(MethodImplOptions.AggressiveInlining)]
        public bool TryGetValue(Type key, out TValue value)
        {
            Entry[] table = this.buckets;
            var hash = key.GetHashCode();
            Entry entry = table[hash & table.Length - 1];

            while (entry != null)
            {
                if (entry.Key == key)
                {
                    value = entry.Value;
                    return true;
                }

                entry = entry.Next;
            }

            value = default(TValue);
            return false;
        }

19 View Source File : DomainEventHandlerInfo.cs
License : MIT License
Project Creator : bing-framework

public override int GetHashCode() => _type.GetHashCode();

19 View Source File : ConvertUtils.cs
License : MIT License
Project Creator : akaskela

public override int GetHashCode()
            {
                return _initialType.GetHashCode() ^ _targetType.GetHashCode();
            }

19 View Source File : ComponentKey.cs
License : MIT License
Project Creator : BlazorComponent

public override int GetHashCode()
        {
            return Name != null ? Type.GetHashCode() ^ Name.GetHashCode() : Type.GetHashCode();
        }

19 View Source File : DynamicInvoker.cs
License : MIT License
Project Creator : amolines

private static int Hash(Type type, string methodname, object[] args)
        {
            var hash = 23;
            hash = hash * 31 + type.GetHashCode();
            hash = hash * 31 + methodname.GetHashCode();
            for (var index = 0; index < args.Length; index++)
            {
                var argtype = args[index].GetType();
                hash = hash * 31 + argtype.GetHashCode();
            }
            return hash;
        }

19 View Source File : MyType.cs
License : GNU General Public License v3.0
Project Creator : blqw

public override int GetHashCode() => GenericTypeDefinition.GetHashCode();

19 View Source File : XmlSerializableDataContractExtensions.cs
License : MIT License
Project Creator : actions

public override int GetHashCode()
            {
                int hashCode = 7443; // "large" prime to start the seed
                
                // Bitshifting and subtracting once is an efficient way to multiply by our second "large" prime, 0x7ffff = 524287
                hashCode = (hashCode << 19) - hashCode + (RootNamespace?.GetHashCode() ?? 0);
                hashCode = (hashCode << 19) - hashCode + ElementName.GetHashCode();
                hashCode = (hashCode << 19) - hashCode + ElementType.GetHashCode();

                return hashCode;
            }

19 View Source File : NodeInfo.cs
License : MIT License
Project Creator : BrunoS3D

public override int GetHashCode()
        {
            if (this.IsEmpty)
            {
                return 0;
            }

            const int P = 16777619;

            unchecked
            {
                return (int)2166136261
                    ^ ((this.Name == null ? 12321 : this.Name.GetHashCode()) * P)
                    ^ (this.Id * P)
                    ^ ((this.Type == null ? 1423 : this.Type.GetHashCode()) * P)
                    ^ ((this.IsArray ? 124124 : 43234) * P)
                    ^ ((this.IsEmpty ? 872934 : 27323) * P);
            }
        }

19 View Source File : HelpPageSampleKey.cs
License : GNU General Public License v3.0
Project Creator : andysal

public override int GetHashCode()
        {
            int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode();
            if (MediaType != null)
            {
                hashCode ^= MediaType.GetHashCode();
            }
            if (SampleDirection != null)
            {
                hashCode ^= SampleDirection.GetHashCode();
            }
            if (ParameterType != null)
            {
                hashCode ^= ParameterType.GetHashCode();
            }
            foreach (string parameterName in ParameterNames)
            {
                hashCode ^= parameterName.ToUpperInvariant().GetHashCode();
            }

            return hashCode;
        }

19 View Source File : Things.cs
License : Apache License 2.0
Project Creator : busterwood

public override int GetHashCode()
        {
            unchecked { return name.GetHashCode() * type.GetHashCode(); }
        }

19 View Source File : Uncapsulator.cs
License : MIT License
Project Creator : albahari

public override int GetHashCode () => Type.GetHashCode () + 37 * base.GetHashCode ();

19 View Source File : SemanticContext.cs
License : MIT License
Project Creator : Butjok

public override int GetHashCode()
            {
                return MurmurHash.HashCode(opnds, typeof(SemanticContext.AND).GetHashCode());
            }

19 View Source File : ConversionSupport.cs
License : Apache License 2.0
Project Creator : apache

protected void SetHashCode()
            {
                long th = TargetType.GetHashCode();
                long sh = SourceType.GetHashCode();
                // Cantor pairing
                hash = (int)((th + sh) * (th + sh + 1) / 2 + sh);
            }

19 View Source File : CMInputCallbackInstaller.cs
License : GNU General Public License v2.0
Project Creator : Caeden117

public override int GetHashCode() => InterfaceType.GetHashCode();

19 View Source File : ReaderCache.cs
License : Apache License 2.0
Project Creator : aadreja

static int GetParameterHash(object dynamicObject)
        {
            unchecked
            {
                int hash = 31; //any prime number
                PropertyInfo[] propertyInfo = dynamicObject.GetType().GetProperties();
                for (int i = 0; i < propertyInfo.Length; i++)
                {
                    object propertyName = propertyInfo[i].Name;
                    //dynamic property will always return System.Object as property type. Get Type from the value
                    Type propertyType = GetTypeOfDynamicProperty(propertyInfo[i], dynamicObject);

                    //prime numbers to generate hash
                    hash = (-97 * ((hash * 29) + propertyName.GetHashCode())) + propertyType.GetHashCode();
                }
                return hash;
            }
        }

19 View Source File : PositionGroupBuyingPowerModel.cs
License : Apache License 2.0
Project Creator : Capnode

public override int GetHashCode()
        {
            return GetType().GetHashCode();
        }

19 View Source File : TypeConstraintAttribute.cs
License : MIT License
Project Creator : arimger

public override int GetHashCode()
        {
            unchecked
            {
                var result = 0;
                result = (result * 397) ^ replacedemblyType.GetHashCode();
                result = (result * 397) ^ AllowAbstract.GetHashCode();
                result = (result * 397) ^ AllowObsolete.GetHashCode();
                return result;
            }
        }

19 View Source File : ExpressionComparer.cs
License : MIT License
Project Creator : albyho

protected virtual int CompareType(Type x, Type y)
        {
            if (x == y) return 0;

            if (CompareNull(x, y, out var result)) return result;

            result = x.GetHashCode() - y.GetHashCode();
            if (result != 0) return result;

            result = String.Compare(x.Name, y.Name, StringComparison.Ordinal);
            if (result != 0) return result;

            return x.replacedemblyQualifiedName.CompareTo(y.replacedemblyQualifiedName);
        }

19 View Source File : EntityMapperProvider.cs
License : Apache License 2.0
Project Creator : 1448376744

public override int GetHashCode()
            {
                return Type.GetHashCode();
            }

19 View Source File : ConversionHelper.cs
License : MIT License
Project Creator : abdullin

public override int GetHashCode()
			{
				// note: we cannot just xor both hash codes, because if left and right are the same, we will return 0
				int h = this.Left.GetHashCode();
				h = (h >> 13) | (h << 19);
				h ^= this.Right.GetHashCode();
				return h;
			}

19 View Source File : NarrowPhase.cs
License : The Unlicense
Project Creator : aeroson

public override int GetHashCode()
        {
            //TODO: Use old hash code system?
            return A.GetHashCode() + B.GetHashCode();
        }

19 View Source File : ThreadsafeTypeKeyHashTable.cs
License : Apache License 2.0
Project Creator : allenai

private bool AddToBuckets(Entry[] buckets, Type newKey, Entry newEntryOrNull, Func<Type, TValue> valueFactory, out TValue resultingValue)
        {
            var h = (newEntryOrNull != null) ? newEntryOrNull.Hash : newKey.GetHashCode();
            if (buckets[h & (buckets.Length - 1)] == null)
            {
                if (newEntryOrNull != null)
                {
                    resultingValue = newEntryOrNull.Value;
                    VolatileWrite(ref buckets[h & (buckets.Length - 1)], newEntryOrNull);
                }
                else
                {
                    resultingValue = valueFactory(newKey);
                    VolatileWrite(ref buckets[h & (buckets.Length - 1)], new Entry { Key = newKey, Value = resultingValue, Hash = h });
                }
            }
            else
            {
                Entry searchLastEntry = buckets[h & (buckets.Length - 1)];
                while (true)
                {
                    if (searchLastEntry.Key == newKey)
                    {
                        resultingValue = searchLastEntry.Value;
                        return false;
                    }

                    if (searchLastEntry.Next == null)
                    {
                        if (newEntryOrNull != null)
                        {
                            resultingValue = newEntryOrNull.Value;
                            VolatileWrite(ref searchLastEntry.Next, newEntryOrNull);
                        }
                        else
                        {
                            resultingValue = valueFactory(newKey);
                            VolatileWrite(ref searchLastEntry.Next, new Entry { Key = newKey, Value = resultingValue, Hash = h });
                        }

                        break;
                    }

                    searchLastEntry = searchLastEntry.Next;
                }
            }

            return true;
        }

19 View Source File : ReflectionCache.cs
License : MIT License
Project Creator : bbepis

public override int GetHashCode()
         {
            return Type.GetHashCode() + MemberName.GetHashCode();
         }

See More Examples