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
19
Source : ExprAlias.cs
with MIT License
from 0x1000000
with MIT License
from 0x1000000
public override int GetHashCode()
{
return this.Name.GetHashCode();
}
19
Source : ExprFunctionName.cs
with MIT License
from 0x1000000
with MIT License
from 0x1000000
public override int GetHashCode()
{
unchecked
{
return (this.BuiltIn.GetHashCode() * 397) ^ this.Name.GetHashCode();
}
}
19
Source : ExprPlainReader.cs
with MIT License
from 0x1000000
with MIT License
from 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
Source : BoxString.cs
with MIT License
from 0xC0000054
with MIT License
from 0xC0000054
public override int GetHashCode()
{
return unchecked(-1937169414 + this.Value.GetHashCode());
}
19
Source : DiscKeyInfo.cs
with MIT License
from 13xforever
with MIT License
from 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
Source : BssomString.cs
with MIT License
from 1996v
with MIT License
from 1996v
public override int GetHashCode()
{
return GetString().GetHashCode();
}
19
Source : Inline_Hook.cs
with Apache License 2.0
from 1694439208
with Apache License 2.0
from 1694439208
public static int ComputeHash(string buffer)
{
return buffer.GetHashCode();
}
19
Source : Seat.cs
with MIT License
from 42skillz
with MIT License
from 42skillz
public override int GetHashCode()
{
unchecked
{
return ((seat_number != null ? seat_number.GetHashCode() : 0) * 397) ^ (coach != null ? coach.GetHashCode() : 0);
}
}
19
Source : Proxy.cs
with MIT License
from 71
with MIT License
from 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
Source : Proxy.cs
with MIT License
from 71
with MIT License
from 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
Source : SimpleJSON.cs
with MIT License
from 71
with MIT License
from 71
public override int GetHashCode()
{
return m_Data.GetHashCode();
}
19
Source : Proxy.cs
with MIT License
from 71
with MIT License
from 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
Source : ReactiveTests.cs
with MIT License
from 71
with MIT License
from 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
Source : Signifier.cs
with MIT License
from 8T4
with MIT License
from 8T4
public override int GetHashCode()
=> (Value != null ? Value.GetHashCode() : 0);
19
Source : DecorationAttribute.cs
with GNU General Public License v3.0
from a2659802
with GNU General Public License v3.0
from a2659802
public override int GetHashCode()
{
return Name.GetHashCode();
}
19
Source : MeshHideInspector.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from 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
Source : Mana.cs
with GNU General Public License v3.0
from a2659802
with GNU General Public License v3.0
from 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
Source : Order.cs
with Apache License 2.0
from Aaronontheweb
with Apache License 2.0
from Aaronontheweb
public override int GetHashCode()
{
return OrderId.GetHashCode();
}
19
Source : Match.cs
with Apache License 2.0
from Aaronontheweb
with Apache License 2.0
from Aaronontheweb
public override int GetHashCode()
{
unchecked
{
var hashCode = StockId.GetHashCode();
hashCode = (hashCode * 397) ^ BuyOrderId.GetHashCode();
hashCode = (hashCode * 397) ^ SellOrderId.GetHashCode();
return hashCode;
}
}
19
Source : Ping.cs
with Apache License 2.0
from Aaronontheweb
with Apache License 2.0
from Aaronontheweb
public override int GetHashCode()
{
return StockId.GetHashCode();
}
19
Source : HighlightingColor.cs
with MIT License
from Abdesol
with MIT License
from 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
Source : StringSegment.cs
with MIT License
from Abdesol
with MIT License
from Abdesol
public override int GetHashCode()
{
return text.GetHashCode() ^ offset ^ count;
}
19
Source : MixedRealityInputAction.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
public override int GetHashCode()
{
return $"{Id}.{AxisConstraint}".GetHashCode();
}
19
Source : BaseGenericInputSource.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from 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
Source : BaseSpatialObserver.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
public override int GetHashCode()
{
return Mathf.Abs(SourceName.GetHashCode());
}
19
Source : GenericPointer.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from 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
Source : BaseBoundarySystem.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
public int GetHashCode(object obj)
{
return Mathf.Abs(SourceName.GetHashCode());
}
19
Source : BaseBoundarySystem.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from 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
Source : AudioLoFiEffect.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
public override int GetHashCode()
{
string s = $"[{GetType().ToString()}] Low: {LowPreplacedCutoff}, High: {HighPreplacedCutoff}";
return s.GetHashCode();
}
19
Source : ToolTip.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from 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
Source : MixedRealityCameraSystem.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
int IEqualityComparer.GetHashCode(object obj)
{
return Mathf.Abs(SourceName.GetHashCode());
}
19
Source : MixedRealityDiagnosticsSystem.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
public int GetHashCode(object obj) => SourceName.GetHashCode();
19
Source : ZoomHistoryMvvmViewModel.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
public override int GetHashCode()
{
return ItemId.GetHashCode();
}
19
Source : ZoomHistoryMvvmViewModel.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
public override int GetHashCode(ChartRangeHistory crh)
{
return crh.ItemId.GetHashCode();
}
19
Source : ExampleLoader.cs
with MIT License
from ABTSoftware
with MIT License
from 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
Source : PowerPlan.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
public override int GetHashCode()
{
unchecked
{
return ((Name != null ? Name.GetHashCode() : 0)*397) ^ Guid.GetHashCode();
}
}
19
Source : Http.cs
with Apache License 2.0
from ac87
with Apache License 2.0
from 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
Source : Http.cs
with Apache License 2.0
from ac87
with Apache License 2.0
from 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
Source : Status.cs
with Apache License 2.0
from ac87
with Apache License 2.0
from 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
Source : FileLocator.cs
with MIT License
from Accelerider
with MIT License
from Accelerider
public override int GetHashCode() => FullPath != null ? FullPath.GetHashCode() : 0;
19
Source : BSPNode.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from 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
Source : PaletteObject.cs
with MIT License
from acoppes
with MIT License
from 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
Source : ExpressionValue.cs
with MIT License
from actions
with MIT License
from 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
Source : FileContainerItem.cs
with MIT License
from actions
with MIT License
from actions
public override int GetHashCode()
{
return Path.GetHashCode();
}
19
Source : AttributeDescriptor.cs
with MIT License
from actions
with MIT License
from actions
public override int GetHashCode()
{
return this.ContainerName.GetHashCode() + this.AttributeName.GetHashCode();
}
19
Source : MaskHint.cs
with MIT License
from actions
with MIT License
from actions
public override Int32 GetHashCode()
{
return this.Type.GetHashCode() ^ (this.Value ?? String.Empty).GetHashCode();
}
19
Source : AttributesQueryContext.cs
with MIT License
from actions
with MIT License
from 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
Source : RegexSecret.cs
with MIT License
from actions
with MIT License
from actions
public override int GetHashCode() => m_pattern.GetHashCode();
19
Source : ValueSecret.cs
with MIT License
from actions
with MIT License
from actions
public override Int32 GetHashCode() => m_value.GetHashCode();
19
Source : PackageVersion.cs
with MIT License
from actions
with MIT License
from actions
public override int GetHashCode()
{
return this.ToString().GetHashCode();
}
See More Examples