string.GetHashCode()

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

7702 Examples 7

19 View Source File : Status.cs
License : Apache License 2.0
Project Creator : ac87

[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override int GetHashCode() {
      int hash = 1;
      if (Code != 0) hash ^= Code.GetHashCode();
      if (Message.Length != 0) hash ^= Message.GetHashCode();
      hash ^= details_.GetHashCode();
      return hash;
    }

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

public override int GetHashCode()
        {
            int hashCode = Scope.GetHashCode();
            hashCode = (hashCode * 499) ^ (ContainerName != null ? ContainerName.ToLowerInvariant().GetHashCode() : 0);
            hashCode = (hashCode * 499) ^ (ModifiedSince != null ? ModifiedSince.GetHashCode() : 0);
            hashCode = (hashCode * 499) ^ (ModifiedAfterRevision != null ? ModifiedAfterRevision.GetHashCode() : 0);
            hashCode = (hashCode * 499) ^ (CoreAttributes != null ? CoreAttributes.GetHashCode() : 0);

            return hashCode;
        }

19 View Source File : MixedRealityInputAction.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public override int GetHashCode()
        {
            return $"{Id}.{AxisConstraint}".GetHashCode();
        }

19 View Source File : ExampleLoader.cs
License : MIT License
Project Creator : ABTSoftware

public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = (ExampleCategory != null ? ExampleCategory.GetHashCode() : 0);
                hashCode = (hashCode*397) ^ (ChartGroup != null ? ChartGroup.GetHashCode() : 0);
                hashCode = (hashCode*397) ^ (Examplereplacedle != null ? Examplereplacedle.GetHashCode() : 0);
                return hashCode;
            }
        }

19 View Source File : BaseBoundarySystem.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public int GetHashCode(object obj)
        {
            return Mathf.Abs(SourceName.GetHashCode());
        }

19 View Source File : Match.cs
License : Apache License 2.0
Project Creator : Aaronontheweb

public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = StockId.GetHashCode();
                hashCode = (hashCode * 397) ^ BuyOrderId.GetHashCode();
                hashCode = (hashCode * 397) ^ SellOrderId.GetHashCode();
                return hashCode;
            }
        }

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

public override Int32 GetHashCode()
        {
            if (IsLiteral)
            {
                if (Literal != null)
                {
                    return Literal.GetHashCode();
                }
            }
            else if (Expression != null)
            {
                return Expression.GetHashCode();
            }

            return 0; // unspecified expression values are all the same.
        }

19 View Source File : SimpleJSON.cs
License : MIT License
Project Creator : 71

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

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

public override int GetHashCode()
        {
            return this.ToString().GetHashCode();
        }

19 View Source File : ReactiveTests.cs
License : MIT License
Project Creator : 71

[Fact]
        public void TestInstanceRedirection()
        {
            MethodInfo method = typeof(TestClreplaced)
                .GetMethod(nameof(TestClreplaced.ComputeHash), BindingFlags.Instance | BindingFlags.Public);

            const int SEED = 0xEA6C23;
            TestClreplaced test = new TestClreplaced(SEED);
            string testStr = "42";
            int testHash   = testStr.GetHashCode();

            test.ComputeHash(testStr).ShouldBe(unchecked(testHash * SEED));
            test.ComputeHash(testStr).ShouldNotBe(SEED);

            using (Redirection.Observe(method, ctx => ctx.ReturnValue = ((TestClreplaced)ctx.Sender).Seed))
            {
                test.ComputeHash(testStr).ShouldBe(SEED);
            }

            test.ComputeHash(testStr).ShouldBe(unchecked(testHash * SEED));
        }

19 View Source File : ZoomHistoryMvvmViewModel.cs
License : MIT License
Project Creator : ABTSoftware

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

19 View Source File : AudioLoFiEffect.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public override int GetHashCode()
            {
                string s = $"[{GetType().ToString()}] Low: {LowPreplacedCutoff}, High: {HighPreplacedCutoff}";
                return s.GetHashCode();
            }

19 View Source File : Mana.cs
License : GNU General Public License v3.0
Project Creator : a2659802

public void UpdateDialogue(string requireText)
            {
                if (string.IsNullOrEmpty(requireText))
                    return;
                string val = requireText;
                string key = $"ManaRquire_{val.GetHashCode()}";
                if (DLanguage.MyLan.ContainsKey(key))
                    DLanguage.MyLan[key] = val;
                else
                    DLanguage.MyLan.Add(key, val);
                
                inspect.GetComponent<PlayMakerFSM>().FsmVariables.GetFsmString("Game Text Convo").Value = key;
            }

19 View Source File : Http.cs
License : Apache License 2.0
Project Creator : ac87

[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override int GetHashCode() {
      int hash = 1;
      if (Selector.Length != 0) hash ^= Selector.GetHashCode();
      if (patternCase_ == PatternOneofCase.Get) hash ^= Get.GetHashCode();
      if (patternCase_ == PatternOneofCase.Put) hash ^= Put.GetHashCode();
      if (patternCase_ == PatternOneofCase.Post) hash ^= Post.GetHashCode();
      if (patternCase_ == PatternOneofCase.Delete) hash ^= Delete.GetHashCode();
      if (patternCase_ == PatternOneofCase.Patch) hash ^= Patch.GetHashCode();
      if (patternCase_ == PatternOneofCase.Custom) hash ^= Custom.GetHashCode();
      if (Body.Length != 0) hash ^= Body.GetHashCode();
      hash ^= additionalBindings_.GetHashCode();
      hash ^= (int) patternCase_;
      return hash;
    }

19 View Source File : Proxy.cs
License : MIT License
Project Creator : 71

public bool TryGet(string name, out object result)
        {
            object obj = Object;

            // Compute key, and try to find an already computed delegate
            int key = Combine(ObjectTypeHash, name.GetHashCode());

            if (data.Getters.TryGetValue(key, out var del))
            {
                result = del(obj);
                return true;
            }

            // Nothing already computed, compute it now
            PropertyInfo prop = obj.GetType().GetProperty(name, ALL);

            if (prop == null)
            {
                result = null;
                return false;
            }

            data.Getters[key] = del = Helpers.MakeDelegate<Func<object, object>>(name, il =>
            {
                if (!(prop.GetMethod ?? prop.SetMethod).IsStatic)
                    il.Emit(OpCodes.Ldarg_0);

                il.Emit(OpCodes.Call, prop.GetMethod);

                if (prop.PropertyType.GetTypeInfo().IsValueType)
                    il.Emit(OpCodes.Box, prop.PropertyType);

                il.Emit(OpCodes.Ret);
            });

            result = del(obj);
            return true;
        }

19 View Source File : BSPNode.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

public override int GetHashCode()
        {
            int hash = 0;

            if (Sphere != null)
                hash = (hash * 397) ^ Sphere.GetHashCode();

            hash = (hash * 397) ^ SplittingPlane.get_hash_code();
            hash = (hash * 397) ^ Type.GetHashCode();

            if (Typename != null)
                hash = (hash * 397) ^ Typename.GetHashCode();

            hash = (hash * 397) ^ NumPolys.GetHashCode();

            for (var i = 0; i < NumPolys; i++)
            {
                hash = (hash * 397) ^ PolyIDs[i].GetHashCode();
                hash = (hash * 397) ^ Polygons[i].GetHashCode();
            }
            if (PosNode != null)
                hash = (hash * 397) ^ PosNode.GetHashCode();

            if (NegNode != null)
                hash = (hash * 397) ^ NegNode.GetHashCode();

            return hash;
        }

19 View Source File : HighlightingColor.cs
License : MIT License
Project Creator : Abdesol

public override int GetHashCode()
		{
			int hashCode = 0;
			unchecked {
				if (name != null)
					hashCode += 1000000007 * name.GetHashCode();
				hashCode += 1000000009 * fontWeight.GetHashCode();
				hashCode += 1000000021 * fontStyle.GetHashCode();
				if (foreground != null)
					hashCode += 1000000033 * foreground.GetHashCode();
				if (background != null)
					hashCode += 1000000087 * background.GetHashCode();
				if (fontFamily != null)
					hashCode += 1000000123 * fontFamily.GetHashCode();
				if (fontSize != null)
					hashCode += 1000000167 * fontSize.GetHashCode();
			}
			return hashCode;
		}

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

public override int GetHashCode()
        {
            return this.ContainerName.GetHashCode() + this.AttributeName.GetHashCode();
        }

19 View Source File : DiscKeyInfo.cs
License : MIT License
Project Creator : 13xforever

public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = DecryptedKeyId?.GetHashCode() ?? 0;
                hashCode = (hashCode * 397) ^ (KeyFileHash?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ (int)KeyType;
                return hashCode;
            }
        }

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

public override Int32 GetHashCode() => m_value.GetHashCode();

19 View Source File : BaseSpatialObserver.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public override int GetHashCode()
        {
            return Mathf.Abs(SourceName.GetHashCode());
        }

19 View Source File : GenericPointer.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = 0;
                hashCode = (hashCode * 397) ^ (int)PointerId;
                hashCode = (hashCode * 397) ^ (PointerName != null ? PointerName.GetHashCode() : 0);
                return hashCode;
            }
        }

19 View Source File : BssomString.cs
License : MIT License
Project Creator : 1996v

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

19 View Source File : BaseBoundarySystem.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private void CreateInscribedBounds()
        {
            // We always use the same seed so that from run to run, the inscribed bounds are consistent.
            RectangularBounds = new InscribedRectangle(Bounds, Mathf.Abs("Mixed Reality Toolkit".GetHashCode()));
        }

19 View Source File : Signifier.cs
License : MIT License
Project Creator : 8T4

public override int GetHashCode()
            => (Value != null ? Value.GetHashCode() : 0);

19 View Source File : MixedRealityDiagnosticsSystem.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public int GetHashCode(object obj) => SourceName.GetHashCode();

19 View Source File : ToolTip.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

protected virtual void RefreshLocalContent()
        {
            // Set the scale of the pivot
            contentParent.transform.localScale = Vector3.one * contentScale;
            label.transform.localScale = Vector3.one * 0.005f;
            // Set the content using a text mesh by default
            // This function can be overridden for tooltips that use Unity UI

            // Has content or fontSize changed?
            int currentTextLength = toolTipText.Length;
            int currentTextHash = toolTipText.GetHashCode();
            int currentFontSize = fontSize;

            // If it has, update the content
            if (currentTextLength != prevTextLength || currentTextHash != prevTextHash || currentFontSize != prevFontSize)
            {
                prevTextHash = currentTextHash;
                prevTextLength = currentTextLength;
                prevFontSize = currentFontSize;

                if (cachedLabelText == null)
                    cachedLabelText = label.GetComponent<TextMeshPro>();

                if (cachedLabelText != null && !string.IsNullOrEmpty(toolTipText))
                {
                    cachedLabelText.fontSize = fontSize;
                    cachedLabelText.text = toolTipText.Trim();
                    // Force text mesh to use center alignment
                    cachedLabelText.alignment = TextAlignmentOptions.CenterGeoAligned;
                    // Update text so we get an accurate scale
                    cachedLabelText.ForceMeshUpdate();
                    // Get the world scale of the text
                    // Convert that to local scale using the content parent
                    Vector3 localScale = Vector3.Scale(cachedLabelText.transform.lossyScale / contentScale, cachedLabelText.textBounds.size);
                    localContentSize.x = localScale.x + backgroundPadding.x;
                    localContentSize.y = localScale.y + backgroundPadding.y;
                }

                // Now that we have the size of our content, get our pivots
                ToolTipUtility.GetAttachPointPositions(ref localAttachPointPositions, localContentSize);
                localAttachPoint = ToolTipUtility.FindClosestAttachPointToAnchor(anchor.transform, contentParent.transform, localAttachPointPositions, PivotType);

                foreach (IToolTipBackground background in backgrounds)
                {
                    background.OnContentChange(localContentSize, LocalContentOffset, contentParent.transform);
                }
            }

            foreach (IToolTipBackground background in backgrounds)
            {
                background.IsVisible = showBackground;
            }

            foreach (IToolTipHighlight highlight in highlights)
            {
                highlight.ShowHighlight = ShowHighlight;
            }
        }

19 View Source File : MeshHideInspector.cs
License : Apache License 2.0
Project Creator : A7ocin

public static Vector2 Drag2D(Vector2 scrollPosition, Rect position)
        {
            int controlID = GUIUtility.GetControlID("Slider".GetHashCode(), FocusType.Preplacedive);
            Event current = Event.current;
            switch (current.GetTypeForControl(controlID))
            {
                case EventType.MouseDown:
                    if (position.Contains(current.mousePosition) && position.width > 50f)
                    {
                        GUIUtility.hotControl = controlID;
                        current.Use();
                        EditorGUIUtility.SetWantsMouseJumping(1);
                    }
                    break;
                case EventType.MouseUp:
                    if (GUIUtility.hotControl == controlID)
                    {
                        GUIUtility.hotControl = 0;
                    }
                    EditorGUIUtility.SetWantsMouseJumping(0);
                    break;
                case EventType.MouseDrag:
                    if (GUIUtility.hotControl == controlID)
                    {
                        scrollPosition -= current.delta * (float)((!current.shift) ? 1 : 3) / Mathf.Min(position.width, position.height) * 140f;
                        scrollPosition.y = Mathf.Clamp(scrollPosition.y, -90f, 90f);
                        current.Use();
                        GUI.changed = true;
                    }
                    break;
            }
            return scrollPosition;
        }

19 View Source File : ZoomHistoryMvvmViewModel.cs
License : MIT License
Project Creator : ABTSoftware

public override int GetHashCode(ChartRangeHistory crh)
            {
                return crh.ItemId.GetHashCode();
            }

19 View Source File : Seat.cs
License : MIT License
Project Creator : 42skillz

public override int GetHashCode()
        {
            unchecked
            {
                return ((seat_number != null ? seat_number.GetHashCode() : 0) * 397) ^ (coach != null ? coach.GetHashCode() : 0);
            }
        }

19 View Source File : PowerPlan.cs
License : MIT License
Project Creator : ABTSoftware

public override int GetHashCode()
        {
            unchecked
            {
                return ((Name != null ? Name.GetHashCode() : 0)*397) ^ Guid.GetHashCode();
            }
        }

19 View Source File : Order.cs
License : Apache License 2.0
Project Creator : Aaronontheweb

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

19 View Source File : Http.cs
License : Apache License 2.0
Project Creator : ac87

[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override int GetHashCode() {
      int hash = 1;
      if (Kind.Length != 0) hash ^= Kind.GetHashCode();
      if (Path.Length != 0) hash ^= Path.GetHashCode();
      return hash;
    }

19 View Source File : BoxString.cs
License : MIT License
Project Creator : 0xC0000054

public override int GetHashCode()
        {
            return unchecked(-1937169414 + this.Value.GetHashCode());
        }

19 View Source File : FileLocator.cs
License : MIT License
Project Creator : Accelerider

public override int GetHashCode() => FullPath != null ? FullPath.GetHashCode() : 0;

19 View Source File : Ping.cs
License : Apache License 2.0
Project Creator : Aaronontheweb

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

19 View Source File : PaletteObject.cs
License : MIT License
Project Creator : acoppes

public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = (name != null ? name.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (sourceObject != null ? sourceObject.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (preview != null ? preview.GetHashCode() : 0);
                return hashCode;
            }
        }

19 View Source File : Proxy.cs
License : MIT License
Project Creator : 71

public bool TrySet(string name, object value)
        {
            // Compute key, and try to find an already computed delegate
            int key = Combine(ObjectTypeHash, name.GetHashCode());

            if (data.Setters.TryGetValue(key, out var del))
            {
                del(Object, value);
                return true;
            }

            // Nothing already computed, compute it now
            PropertyInfo prop = ObjectType.GetProperty(name, ALL);

            if (prop == null)
                return false;

            data.Setters[key] = Helpers.MakeDelegate<Func<object, object, object>>(name, il =>
            {
                if ((prop.GetMethod ?? prop.SetMethod).IsStatic)
                {
                    il.Emit(OpCodes.Ldarg_0);
                }
                else
                {
                    il.Emit(OpCodes.Ldarg_0);
                    il.Emit(OpCodes.Ldarg_1);
                }

                if (prop.PropertyType.GetTypeInfo().IsValueType)
                    il.Emit(OpCodes.Unbox_Any);
                else if (prop.PropertyType != typeof(object))
                    il.Emit(OpCodes.Castclreplaced, prop.PropertyType);

                il.Emit(OpCodes.Call, prop.SetMethod);

                if (prop.PropertyType.GetTypeInfo().IsValueType)
                    il.Emit(OpCodes.Box, prop.PropertyType);

                il.Emit(OpCodes.Ret);
            });

            return true;
        }

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

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

19 View Source File : StringSegment.cs
License : MIT License
Project Creator : Abdesol

public override int GetHashCode()
		{
			return text.GetHashCode() ^ offset ^ count;
		}

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

public override Int32 GetHashCode()
        {
            return this.Type.GetHashCode() ^ (this.Value ?? String.Empty).GetHashCode();
        }

19 View Source File : ExprFunctionName.cs
License : MIT License
Project Creator : 0x1000000

public override int GetHashCode()
        {
            unchecked
            {
                return (this.BuiltIn.GetHashCode() * 397) ^ this.Name.GetHashCode();
            }
        }

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

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

19 View Source File : BaseGenericInputSource.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = 0;
                hashCode = (hashCode * 397) ^ (int)SourceId;
                hashCode = (hashCode * 397) ^ (SourceName != null ? SourceName.GetHashCode() : 0);
                return hashCode;
            }
        }

19 View Source File : Proxy.cs
License : MIT License
Project Creator : 71

public bool TryInvoke(string name, object[] args, out object result)
        {
            object obj = Object;

            // Compute key, and try to find an already computed delegate
            int key = Combine(Combine(ObjectTypeHash, name.GetHashCode()), args.Length.GetHashCode());
            var objType = obj.GetType();

            if (data.Invokers.TryGetValue(key, out var del))
            {
                result = del(obj, args);
                return true;
            }

            // Nothing already computed, compute it now
            MethodInfo mi = FindMatchingMethod(objType.GetMethods(ALL), name, args) as MethodInfo;

            if (mi == null)
            {
                result = null;
                return false;
            }

            result = mi.Invoke(obj, args);
            return true;

            // TODO: Fix this. I can't get it to work.
            //data.Invokers[key] = del = Helpers.MakeDelegate<Func<object, object[], object>>(name, il =>
            //{
            //    bool isStatic = mi.IsStatic;

            //    if (!isStatic)
            //    {
            //        Type declaringType = mi.DeclaringType;

            //        il.Emit(OpCodes.Ldarg_0);

            //        if (declaringType.GetTypeInfo().IsValueType)
            //        {
            //            LocalBuilder loc = il.DeclareLocal(declaringType, false);

            //            il.Emit(OpCodes.Unbox_Any, declaringType);
            //            il.Emit(OpCodes.Stloc, loc);
            //            il.Emit(OpCodes.Ldloca, loc);
            //        }
            //        else // Who the f proxies object? if (declaringType != typeof(object))
            //        {
            //            il.Emit(OpCodes.Castclreplaced, declaringType);
            //        }
            //    }

            //    for (int j = 0; j < parameters.Length; j++)
            //    {
            //        Type type = parameters[j].ParameterType;

            //        il.Emit(OpCodes.Ldarg_1);
            //        il.Emit(OpCodes.Ldc_I4, j);
            //        il.Emit(OpCodes.Ldelem_Ref);

            //        if (type.GetTypeInfo().IsValueType)
            //            il.Emit(OpCodes.Unbox_Any, type);
            //        else if (type != typeof(object))
            //            il.Emit(OpCodes.Castclreplaced, type);
            //    }

            //    il.Emit(isStatic || mi.DeclaringType.GetTypeInfo().IsValueType ? OpCodes.Call : OpCodes.Callvirt, mi);

            //    if (mi.ReturnType.GetTypeInfo().IsValueType)
            //    {
            //        il.Emit(OpCodes.Box, mi.ReturnType);
            //    }
            //    else if (mi.ReturnType == typeof(void))
            //    {
            //        il.Emit(OpCodes.Ldnull);
            //    }

            //    il.Emit(OpCodes.Ret);
            //}, mi.DeclaringType);

            //result = del(obj, args);
            //return true;
        }

19 View Source File : ExprAlias.cs
License : MIT License
Project Creator : 0x1000000

public override int GetHashCode()
        {
            return this.Name.GetHashCode();
        }

19 View Source File : ExprPlainReader.cs
License : MIT License
Project Creator : 0x1000000

public override int GetHashCode()
            {
                unchecked
                {
                    var hashCode = this.ParentId;
                    hashCode = (hashCode * 397) ^ this.PropertyName.GetHashCode();
                    hashCode = (hashCode * 397) ^ this.ArrayIndex.GetHashCode();
                    return hashCode;
                }
            }

19 View Source File : Inline_Hook.cs
License : Apache License 2.0
Project Creator : 1694439208

public static int ComputeHash(string buffer)
        {
            return buffer.GetHashCode();
        }

19 View Source File : DecorationAttribute.cs
License : GNU General Public License v3.0
Project Creator : a2659802

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

19 View Source File : MixedRealityCameraSystem.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

int IEqualityComparer.GetHashCode(object obj)
        {
            return Mathf.Abs(SourceName.GetHashCode());
        }

See More Examples