Here are the examples of the csharp api object.GetHashCode() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5038 Examples
19
Source : TriggerConfigMeta.cs
with MIT License
from aliyun
with MIT License
from aliyun
public override int GetHashCode()
{
return string.Format("{0}_{1}",
AuthType.GetHashCode(), Methods.GetHashCode()).GetHashCode();
}
19
Source : ShapeEditor.cs
with MIT License
from all-iver
with MIT License
from all-iver
void OnSceneGUI() {
Shape shape = (Shape) target;
if (!isEditing || (shape.settings.shapeType != ShapeType.Polygon && shape.settings.shapeType != ShapeType.Path))
return;
if (Tools.current != Tool.None) {
StopEditingShape(false);
return;
}
// draw some borders so the user knows where the shape should live
DrawShapeBorders(shape);
if (shape.settings.shapeType == ShapeType.Polygon)
EditPolygon(shape);
else
EditPath(shape);
// this prevents the user selecting another object when they are
// adding poly/path nodes
if (Event.current.type == EventType.Layout)
HandleUtility.AddDefaultControl(GUIUtility.GetControlID(GetHashCode(), FocusType.Preplacedive));
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1, T2, T3, T4, T5, T6, T7, T8>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
{
unchecked
{
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
uint hc4 = (uint)(value4?.GetHashCode() ?? 0);
uint hc5 = (uint)(value5?.GetHashCode() ?? 0);
uint hc6 = (uint)(value6?.GetHashCode() ?? 0);
uint hc7 = (uint)(value7?.GetHashCode() ?? 0);
uint hc8 = (uint)(value8?.GetHashCode() ?? 0);
Initialize(out uint v1, out uint v2, out uint v3, out uint v4);
v1 = Round(v1, hc1);
v2 = Round(v2, hc2);
v3 = Round(v3, hc3);
v4 = Round(v4, hc4);
v1 = Round(v1, hc5);
v2 = Round(v2, hc6);
v3 = Round(v3, hc7);
v4 = Round(v4, hc8);
uint hash = MixState(v1, v2, v3, v4);
hash += 32;
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1, T2, T3, T4, T5, T6, T7>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
{
unchecked
{
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
uint hc4 = (uint)(value4?.GetHashCode() ?? 0);
uint hc5 = (uint)(value5?.GetHashCode() ?? 0);
uint hc6 = (uint)(value6?.GetHashCode() ?? 0);
uint hc7 = (uint)(value7?.GetHashCode() ?? 0);
Initialize(out uint v1, out uint v2, out uint v3, out uint v4);
v1 = Round(v1, hc1);
v2 = Round(v2, hc2);
v3 = Round(v3, hc3);
v4 = Round(v4, hc4);
uint hash = MixState(v1, v2, v3, v4);
hash += 28;
hash = QueueRound(hash, hc5);
hash = QueueRound(hash, hc6);
hash = QueueRound(hash, hc7);
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1>(T1 value1)
{
unchecked
{
// Provide a way of diffusing bits from something with a limited
// input hash space. For example, many enums only have a few
// possible hashes, only using the bottom few bits of the code. Some
// collections are built on the replacedumption that hashes are spread
// over a larger space, so diffusing the bits may help the
// collection work more efficiently.
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hash = MixEmptyState();
hash += 4;
hash = QueueRound(hash, hc1);
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1, T2>(T1 value1, T2 value2)
{
unchecked
{
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
uint hash = MixEmptyState();
hash += 8;
hash = QueueRound(hash, hc1);
hash = QueueRound(hash, hc2);
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1, T2, T3>(T1 value1, T2 value2, T3 value3)
{
unchecked
{
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
uint hash = MixEmptyState();
hash += 12;
hash = QueueRound(hash, hc1);
hash = QueueRound(hash, hc2);
hash = QueueRound(hash, hc3);
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4)
{
unchecked
{
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
uint hc4 = (uint)(value4?.GetHashCode() ?? 0);
Initialize(out uint v1, out uint v2, out uint v3, out uint v4);
v1 = Round(v1, hc1);
v2 = Round(v2, hc2);
v3 = Round(v3, hc3);
v4 = Round(v4, hc4);
uint hash = MixState(v1, v2, v3, v4);
hash += 16;
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1, T2, T3, T4, T5>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
{
unchecked
{
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
uint hc4 = (uint)(value4?.GetHashCode() ?? 0);
uint hc5 = (uint)(value5?.GetHashCode() ?? 0);
Initialize(out uint v1, out uint v2, out uint v3, out uint v4);
v1 = Round(v1, hc1);
v2 = Round(v2, hc2);
v3 = Round(v3, hc3);
v4 = Round(v4, hc4);
uint hash = MixState(v1, v2, v3, v4);
hash += 20;
hash = QueueRound(hash, hc5);
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public static int Combine<T1, T2, T3, T4, T5, T6>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
{
unchecked
{
uint hc1 = (uint)(value1?.GetHashCode() ?? 0);
uint hc2 = (uint)(value2?.GetHashCode() ?? 0);
uint hc3 = (uint)(value3?.GetHashCode() ?? 0);
uint hc4 = (uint)(value4?.GetHashCode() ?? 0);
uint hc5 = (uint)(value5?.GetHashCode() ?? 0);
uint hc6 = (uint)(value6?.GetHashCode() ?? 0);
Initialize(out uint v1, out uint v2, out uint v3, out uint v4);
v1 = Round(v1, hc1);
v2 = Round(v2, hc2);
v3 = Round(v3, hc3);
v4 = Round(v4, hc4);
uint hash = MixState(v1, v2, v3, v4);
hash += 24;
hash = QueueRound(hash, hc5);
hash = QueueRound(hash, hc6);
hash = MixFinal(hash);
return (int)hash;
}
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public void Add<T>(T value)
{
Add(value?.GetHashCode() ?? 0);
}
19
Source : HashCode.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public void Add<T>(T value, IEqualityComparer<T> comparer)
{
Add(comparer != null ? comparer.GetHashCode(value) : (value?.GetHashCode() ?? 0));
}
19
Source : MessagePackSecurity.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public int GetHashCode(object value)
{
if (value is null)
{
return 0;
}
Type valueType = value.GetType();
// Take care to avoid recursion.
if (valueType == typeof(object))
{
// We can trust object.GetHashCode() to be collision resistant.
return value.GetHashCode();
}
if (!equalityComparerCache.TryGetValue(valueType, out IEqualityComparer equalityComparer))
{
try
{
equalityComparer = (IEqualityComparer)GetHashCollisionResistantEqualityComparerOpenGenericMethod.MakeGenericMethod(valueType).Invoke(this.security, Array.Empty<object>());
}
catch (TargetInvocationException ex)
{
ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
}
equalityComparerCache.TryAdd(valueType, equalityComparer);
}
return equalityComparer.GetHashCode(value);
}
19
Source : VoronoiEdge.cs
with Apache License 2.0
from allenai
with Apache License 2.0
from allenai
public override int GetHashCode()
{
var hash = 23;
hash = hash * 31 + Source.GetHashCode();
return hash * 31 + Target.GetHashCode();
}
19
Source : TCollections.cs
with MIT License
from aloneguid
with MIT License
from aloneguid
public static int GetHashCode (IEnumerable enumerable)
{
if (enumerable == null)
{
return 0;
}
int hashcode = 0;
foreach (Object obj in enumerable)
{
IEnumerable enum2 = obj as IEnumerable;
int objHash = enum2 == null ? obj.GetHashCode () : GetHashCode (enum2);
unchecked
{
hashcode = (hashcode * 397) ^ (objHash);
}
}
return hashcode;
}
19
Source : BasicDataTypeHandler.cs
with MIT License
from aloneguid
with MIT License
from aloneguid
public int GetHashCode(TSystemType x) => x.GetHashCode();
19
Source : NaiveMatrix.cs
with MIT License
from altimesh
with MIT License
from altimesh
public override int GetHashCode()
{
return values.GetHashCode();
}
19
Source : CreateEmailOption.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public override int GetHashCode()
{
// Overflow is fine, just wrap
unchecked
{
int hashCode = 41;
if (this.Emails != null)
{
hashCode = (hashCode * 59) + this.Emails.GetHashCode();
}
return hashCode;
}
}
19
Source : GPGKey.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public override int GetHashCode()
{
// Overflow is fine, just wrap
unchecked
{
int hashCode = 41;
if (this.CanCertify != null)
{
hashCode = (hashCode * 59) + this.CanCertify.GetHashCode();
}
if (this.CanEncryptComms != null)
{
hashCode = (hashCode * 59) + this.CanEncryptComms.GetHashCode();
}
if (this.CanEncryptStorage != null)
{
hashCode = (hashCode * 59) + this.CanEncryptStorage.GetHashCode();
}
if (this.CanSign != null)
{
hashCode = (hashCode * 59) + this.CanSign.GetHashCode();
}
if (this.CreatedAt != null)
{
hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode();
}
if (this.Emails != null)
{
hashCode = (hashCode * 59) + this.Emails.GetHashCode();
}
if (this.ExpiresAt != null)
{
hashCode = (hashCode * 59) + this.ExpiresAt.GetHashCode();
}
if (this.Id != null)
{
hashCode = (hashCode * 59) + this.Id.GetHashCode();
}
if (this.KeyId != null)
{
hashCode = (hashCode * 59) + this.KeyId.GetHashCode();
}
if (this.PrimaryKeyId != null)
{
hashCode = (hashCode * 59) + this.PrimaryKeyId.GetHashCode();
}
if (this.PublicKey != null)
{
hashCode = (hashCode * 59) + this.PublicKey.GetHashCode();
}
if (this.Subkeys != null)
{
hashCode = (hashCode * 59) + this.Subkeys.GetHashCode();
}
return hashCode;
}
}
19
Source : SearchResults.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public override int GetHashCode()
{
// Overflow is fine, just wrap
unchecked
{
int hashCode = 41;
if (this.Data != null)
{
hashCode = (hashCode * 59) + this.Data.GetHashCode();
}
if (this.Ok != null)
{
hashCode = (hashCode * 59) + this.Ok.GetHashCode();
}
return hashCode;
}
}
19
Source : Variable.cs
with MIT License
from AMalininHere
with MIT License
from AMalininHere
[ExcludeFromCodeCoverage]
public override int GetHashCode()
{
unchecked
{
return ((Value != null ? Value.GetHashCode() : 0) * 397) ^ (int) Type;
}
}
19
Source : Entity.cs
with MIT License
from ambleside138
with MIT License
from ambleside138
public override int GetHashCode()
{
return GetIdenreplacedyValues()
.Select(x => x != null ? x.GetHashCode() : 0)
.Aggregate((x, y) => x ^ y);
}
19
Source : ValueObject.cs
with MIT License
from ambleside138
with MIT License
from ambleside138
public override int GetHashCode()
{
return GetAtomicValues()
.Select(x => x != null ? x.GetHashCode() : 0)
.Aggregate((x, y) => x ^ y);
}
19
Source : Request.cs
with MIT License
from AndreasAmMueller
with MIT License
from AndreasAmMueller
public override int GetHashCode()
=> base.GetHashCode() ^
TransactionId.GetHashCode() ^
DeviceId.GetHashCode() ^
Function.GetHashCode() ^
Address.GetHashCode() ^
Count.GetHashCode() ^
Bytes.GetHashCode();
19
Source : Response.cs
with MIT License
from AndreasAmMueller
with MIT License
from AndreasAmMueller
public override int GetHashCode()
=> base.GetHashCode() ^
TransactionId.GetHashCode() ^
DeviceId.GetHashCode() ^
Function.GetHashCode() ^
Address.GetHashCode() ^
Count.GetHashCode() ^
Data.GetHashCode();
19
Source : Request.cs
with MIT License
from AndreasAmMueller
with MIT License
from AndreasAmMueller
public override int GetHashCode()
=> base.GetHashCode() ^
DeviceId.GetHashCode() ^
Function.GetHashCode() ^
Address.GetHashCode() ^
Count.GetHashCode() ^
Bytes.GetHashCode();
19
Source : Response.cs
with MIT License
from AndreasAmMueller
with MIT License
from AndreasAmMueller
public override int GetHashCode()
=> base.GetHashCode() ^
DeviceId.GetHashCode() ^
Function.GetHashCode() ^
Address.GetHashCode() ^
Count.GetHashCode() ^
Data.GetHashCode();
19
Source : DataBuffer.cs
with MIT License
from AndreasAmMueller
with MIT License
from AndreasAmMueller
public override int GetHashCode()
=> base.GetHashCode()
^ Length.GetHashCode()
^ Buffer.GetHashCode()
^ IsLittleEndian.GetHashCode();
19
Source : ModbusObject.cs
with MIT License
from AndreasAmMueller
with MIT License
from AndreasAmMueller
public override int GetHashCode()
=> base.GetHashCode() ^
Address.GetHashCode() ^
HiByte.GetHashCode() ^
LoByte.GetHashCode();
19
Source : WindowsService.cs
with GNU General Public License v3.0
from AndreiFedarets
with GNU General Public License v3.0
from AndreiFedarets
public override int GetHashCode()
{
return _controller.GetHashCode();
}
19
Source : Face.cs
with GNU General Public License v3.0
from andy-wood
with GNU General Public License v3.0
from andy-wood
public override int GetHashCode() { return base.GetHashCode (); }
19
Source : Pair.cs
with GNU General Public License v3.0
from andy-wood
with GNU General Public License v3.0
from andy-wood
public override int GetHashCode() { return Ext.hash (_p0.GetHashCode (), _p1.GetHashCode ()); }
19
Source : Service.cs
with MIT License
from andyalm
with MIT License
from andyalm
public override int GetHashCode()
{
unchecked
{
var hashCode = (Name != null ? Name.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Address != null ? Address.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Port;
hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0);
return hashCode;
}
}
19
Source : Service.cs
with MIT License
from andyalm
with MIT License
from andyalm
public override int GetHashCode()
{
unchecked
{
var hashCode = (Id != null ? Id.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Nodes != null ? Nodes.GetHashCode() : 0);
return hashCode;
}
}
19
Source : FenceLayoutEditor.cs
with MIT License
from AndyFenwick
with MIT License
from AndyFenwick
void InputUpdate(SceneView sceneview)
{
Event e = Event.current;
int controlID = GUIUtility.GetControlID(GetHashCode(), FocusType.Preplacedive);
if (e.control)
{
HandleUtility.AddDefaultControl(controlID);
}
if (e.type != EventType.Repaint && e.type != EventType.Layout)
{
GameObject fenceObj = Selection.activeObject as GameObject;
if (fenceObj)
{
FenceLayout fence = fenceObj.GetComponent<FenceLayout>();
if (fence)
{
m_editMode = FenceLayout.EditMode.None;
fence.SetEditMode(FenceLayout.EditMode.None, new Vector3());
if (e.control)
{
Ray r = HandleUtility.GUIPointToWorldRay(e.mousePosition);
RaycastHit result;
if (Physics.Raycast(r, out result))
{
m_editMode = (e.control && e.shift) ? FenceLayout.EditMode.Delete : (e.control ? FenceLayout.EditMode.Add : FenceLayout.EditMode.None);
m_mousePos = result.point;
fence.SetEditMode(m_editMode, result.point);
if (e.control && e.button == 0)
{
if (e.type == EventType.MouseDown)
{
ApplyEdit();
EditorUtility.SetDirty(fence);
}
}
}
}
}
}
}
}
19
Source : Entity.cs
with Apache License 2.0
from aneshas
with Apache License 2.0
from aneshas
public override int GetHashCode()
{
if (Id.Equals(default(TIdenreplacedy)))
{
return base.GetHashCode();
}
return GetType().GetHashCode() ^ Id.GetHashCode();
}
19
Source : Entity.cs
with MIT License
from anjoy8
with MIT License
from anjoy8
public override int GetHashCode()
{
if (!IsTransient())
{
if (!_requestedHashCode.HasValue)
_requestedHashCode = this.Id.GetHashCode() ^ 31; // XOR for random distribution (http://blogs.msdn.com/b/ericlippert/archive/2011/02/28/guidelines-and-rules-for-gethashcode.aspx)
return _requestedHashCode.Value;
}
else
return base.GetHashCode();
}
19
Source : ArrayHelper.cs
with Apache License 2.0
from AnkiUniversal
with Apache License 2.0
from AnkiUniversal
public static int GetJavaListHashCode<T>(this List<T> values)
{
int hashCode = 1;
for (int i = 0; i < values.Count; i++)
hashCode = 31 * hashCode + (values[i] == null ? 0 : values[i].GetHashCode());
return hashCode;
}
19
Source : BuildingInfoComparer.cs
with MIT License
from AnnoDesigner
with MIT License
from AnnoDesigner
public int GetHashCode(IBuildingInfo obj)
{
if (obj == null)
{
return -1;
}
unchecked
{
var hashCode = obj.Group != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Group) : 0;
//hashCode = (hashCode * 397) ^ (obj.Identifier != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Identifier) : 0);
return hashCode;
}
}
19
Source : WikiTextTableEntryComparer.cs
with MIT License
from AnnoDesigner
with MIT License
from AnnoDesigner
public int GetHashCode(WikiTextTableEntry obj)
{
if (obj == null)
{
return -1;
}
unchecked
{
//name cannot be null
var hashCode = StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Name);
hashCode = (hashCode * 397) ^ obj.Region.GetHashCode();
return hashCode;
}
}
19
Source : EqualityComparer.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta
with BSD 3-Clause "New" or "Revised" License
from anoyetta
public int GetHashCode(T obj) =>
this.getHashCodeCallback?.Invoke(obj) ?? obj.GetHashCode();
19
Source : Dbg.cs
with Apache License 2.0
from AnthonyLloyd
with Apache License 2.0
from AnthonyLloyd
[MethodImpl(MethodImplOptions.NoInlining)]
Entry[] Resize()
{
var oldEntries = entries;
if (oldEntries.Length == 1) return entries = new Entry[2];
var newEntries = new Entry[oldEntries.Length * 2];
for (int i = 0; i < oldEntries.Length;)
{
var bucketIndex = oldEntries[i].Key.GetHashCode() & (newEntries.Length - 1);
newEntries[i].Next = newEntries[bucketIndex].Bucket - 1;
newEntries[i].Key = oldEntries[i].Key;
newEntries[i].Value = oldEntries[i].Value;
newEntries[bucketIndex].Bucket = ++i;
}
return entries = newEntries;
}
19
Source : Dbg.cs
with Apache License 2.0
from AnthonyLloyd
with Apache License 2.0
from AnthonyLloyd
public ref V GetValueOrNullRef(K key)
{
var ent = entries;
var hashCode = key.GetHashCode();
var i = ent[hashCode & (ent.Length - 1)].Bucket - 1;
while (i >= 0 && !key.Equals(ent[i].Key)) i = ent[i].Next;
if (i >= 0) return ref ent[i].Value;
else
{
i = count;
if (ent.Length == i || ent.Length == 1) ent = Resize();
var bucketIndex = hashCode & (ent.Length - 1);
ent[i].Next = ent[bucketIndex].Bucket - 1;
ent[i].Key = key;
ent[i].Value = default;
ent[bucketIndex].Bucket = ++count;
return ref ent[i].Value;
}
}
19
Source : SlimCollectionsTests.cs
with Apache License 2.0
from AnthonyLloyd
with Apache License 2.0
from AnthonyLloyd
[MethodImpl(MethodImplOptions.NoInlining)]
Entry[] Resize()
{
if (entries.Length == 1) return entries = new Entry[2];
var oldEntries = entries;
var newEntries = new Entry[oldEntries.Length * 2];
for (int i = 0; i < oldEntries.Length;)
{
var bucketIndex = oldEntries[i].Item.GetHashCode() & (newEntries.Length - 1);
newEntries[i].Next = newEntries[bucketIndex].Bucket - 1;
newEntries[i].Item = oldEntries[i].Item;
newEntries[bucketIndex].Bucket = ++i;
}
return entries = newEntries;
}
19
Source : SlimCollectionsTests.cs
with Apache License 2.0
from AnthonyLloyd
with Apache License 2.0
from AnthonyLloyd
public int Add(T item)
{
var ent = entries;
var hashCode = item.GetHashCode();
var i = ent[hashCode & (ent.Length - 1)].Bucket - 1;
while (i >= 0 && !item.Equals(ent[i].Item)) i = ent[i].Next;
return i >= 0 ? i : AddItem(item, hashCode);
}
19
Source : SlimCollectionsTests.cs
with Apache License 2.0
from AnthonyLloyd
with Apache License 2.0
from AnthonyLloyd
public int IndexOf(T item)
{
var ent = entries;
var hashCode = item.GetHashCode();
var i = ent[hashCode & (ent.Length - 1)].Bucket - 1;
while (i >= 0 && !item.Equals(ent[i].Item)) i = ent[i].Next;
return i;
}
19
Source : SlimCollectionsTests.cs
with Apache License 2.0
from AnthonyLloyd
with Apache License 2.0
from AnthonyLloyd
public bool Contains(T item)
{
var ent = entries;
var hashCode = item.GetHashCode();
var i = ent[hashCode & (ent.Length - 1)].Bucket - 1;
while (i >= 0 && !item.Equals(ent[i].Item)) i = ent[i].Next;
return i >= 0;
}
19
Source : SlimCollectionsTests.cs
with Apache License 2.0
from AnthonyLloyd
with Apache License 2.0
from AnthonyLloyd
public int IndexOf(K key)
{
var ent = entries;
var hashCode = key.GetHashCode();
var i = ent[hashCode & (ent.Length - 1)].Bucket - 1;
while (i >= 0 && !key.Equals(ent[i].Key)) i = ent[i].Next;
return i;
}
19
Source : TagTypeAndName.cs
with MIT License
from AntonyCorbett
with MIT License
from AntonyCorbett
public override int GetHashCode()
{
return new { TagType, Name }.GetHashCode();
}
19
Source : TypeResolver.cs
with GNU General Public License v3.0
from anydream
with GNU General Public License v3.0
from anydream
public int ObjectHashCode()
{
return base.GetHashCode();
}
See More Examples