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
19
Source : NonAllocString.cs
with MIT License
from friuns2
with MIT License
from friuns2
public override int GetHashCode()
{
if (obj != null) return CombineHash(type.GetHashCode(), obj.GetHashCode());
if (type == typeof(int)) return CombineHash(integer.GetHashCode(), 2345);
if (type == typeof(float)) return CombineHash(float2.GetHashCode(), 4933);
throw new Exception("dad");
}
19
Source : XmlUtility.cs
with MIT License
from fudiwei
with MIT License
from fudiwei
private static XmlSerializer GetTypedSerializer(Type type)
{
if (type == null) throw new ArgumentNullException(nameof(type));
string skey = type.replacedemblyQualifiedName ?? type.GetHashCode().ToString();
XmlSerializer? xmlSerializer = (XmlSerializer?)_xmlSerializers[skey];
if (xmlSerializer == null)
{
xmlSerializer = new XmlSerializer(type, _xmlRoot);
_xmlSerializers[skey] = xmlSerializer;
}
return xmlSerializer;
}
19
Source : SimpleInterningProvider.cs
with MIT License
from fuse-open
with MIT License
from fuse-open
public int GetHashCode(IEnumerable obj)
{
int hashCode = obj.GetType().GetHashCode();
unchecked {
foreach (object o in obj) {
hashCode *= 27;
hashCode += RuntimeHelpers.GetHashCode(o);
}
}
return hashCode;
}
19
Source : BindingId.cs
with Apache License 2.0
from futurice
with Apache License 2.0
from futurice
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hash = 17;
hash = hash * 29 + this.Type.GetHashCode();
hash = hash * 29 + (this.Identifier == null ? 0 : this.Identifier.GetHashCode());
return hash;
}
}
19
Source : SubContainerSingletonProviderCreatorByInstaller.cs
with Apache License 2.0
from futurice
with Apache License 2.0
from futurice
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hash = 17;
hash = hash * 29 + (this.ConcreteIdentifier == null ? 0 : this.ConcreteIdentifier.GetHashCode());
hash = hash * 29 + this.InstallerType.GetHashCode();
return hash;
}
}
19
Source : SingletonId.cs
with Apache License 2.0
from futurice
with Apache License 2.0
from futurice
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hash = 17;
hash = hash * 29 + this.ConcreteType.GetHashCode();
hash = hash * 29 + (this.ConcreteIdentifier == null ? 0 : this.ConcreteIdentifier.GetHashCode());
return hash;
}
}
19
Source : World.cs
with MIT License
from FuzzySlipper
with MIT License
from FuzzySlipper
public static T Add<T>(Type type = null) where T : new() {
var hash = type == null ? typeof(T).GetHashCode() : type.GetHashCode();
if (Instance._data.TryGetValue(hash, out var o)) {
return (T) o;
}
var created = new T();
//InitializeObject(created);
Instance._data.Add(hash, created);
return created;
}
19
Source : World.cs
with MIT License
from FuzzySlipper
with MIT License
from FuzzySlipper
public static bool Contains<T>() {
return Instance._data.ContainsKey(typeof(T).GetHashCode());
}
19
Source : SerializableType.cs
with MIT License
from FuzzySlipper
with MIT License
from FuzzySlipper
public override int GetHashCode() {
return TargetType.GetHashCode();
}
19
Source : Entity.cs
with MIT License
from FuzzySlipper
with MIT License
from FuzzySlipper
public override int Compare(System.Type x, System.Type y) {
if (ReferenceEquals(x, y) || (x == null || y == null)) {
return 0;
}
return x.GetHashCode().CompareTo(y.GetHashCode());
}
19
Source : LocalizableResourceString.cs
with MIT License
from GGG-KILLER
with MIT License
from GGG-KILLER
protected override int GetHash()
{
return Hash.Combine(_nameOfLocalizableResource.GetHashCode(),
Hash.Combine(_resourceManager.GetHashCode(),
Hash.Combine(_resourceSource.GetHashCode(),
Hash.CombineValues(_formatArguments))));
}
19
Source : TypeDictionary.cs
with MIT License
from gheyret
with MIT License
from gheyret
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private int GetHashCode(Type key)
{
return key.GetHashCode() & 0x7fffffff;
}
19
Source : TimeInterval.cs
with MIT License
from Giannoudis
with MIT License
from Giannoudis
public sealed override int GetHashCode()
{
return HashTool.AddHashCode( GetType().GetHashCode(), ComputeHashCode() );
}
19
Source : DateDiff.cs
with MIT License
from Giannoudis
with MIT License
from Giannoudis
public override int GetHashCode()
{
return HashTool.ComputeHashCode( GetType().GetHashCode(),
calendar,
yearBaseMonth,
firstDayOfWeek,
date1,
date2,
difference );
}
19
Source : Date.cs
with MIT License
from Giannoudis
with MIT License
from Giannoudis
public override int GetHashCode()
{
return HashTool.ComputeHashCode( GetType().GetHashCode(), date );
}
19
Source : Time.cs
with MIT License
from Giannoudis
with MIT License
from Giannoudis
public override int GetHashCode()
{
return HashTool.ComputeHashCode( GetType().GetHashCode(), duration );
}
19
Source : EventManager.cs
with MIT License
from gmhevinci
with MIT License
from gmhevinci
public void AddListener(System.Type eventType, System.Action<IEventMessage> listener)
{
int eventId = eventType.GetHashCode();
AddListener(eventId, listener);
}
19
Source : EventManager.cs
with MIT License
from gmhevinci
with MIT License
from gmhevinci
public void RemoveListener(System.Type eventType, System.Action<IEventMessage> listener)
{
int eventId = eventType.GetHashCode();
RemoveListener(eventId, listener);
}
19
Source : HotfixEventManager.cs
with MIT License
from gmhevinci
with MIT License
from gmhevinci
public void AddListener<TEvent>(System.Action<IEventMessage> listener) where TEvent : IEventMessage
{
int eventId = typeof(TEvent).GetHashCode();
EventManager.Instance.AddListener(eventId, listener);
}
19
Source : HotfixEventManager.cs
with MIT License
from gmhevinci
with MIT License
from gmhevinci
public void RemoveListener<TEvent>(System.Action<IEventMessage> listener) where TEvent : IEventMessage
{
int eventId = typeof(TEvent).GetHashCode();
EventManager.Instance.RemoveListener(eventId, listener);
}
19
Source : TableNameExtensions.cs
with MIT License
from gnaeus
with MIT License
from gnaeus
public override int GetHashCode()
{
return ContextType.GetHashCode() ^ EnreplacedyType.GetHashCode();
}
19
Source : ApplicationDirectoryMembershipCondition.cs
with MIT License
from GrapeCity
with MIT License
from GrapeCity
public override int GetHashCode ()
{
return typeof (ApplicationDirectoryMembershipCondition).GetHashCode ();
}
19
Source : AllMembershipCondition.cs
with MIT License
from GrapeCity
with MIT License
from GrapeCity
public override int GetHashCode ()
{
return typeof (AllMembershipCondition).GetHashCode ();
}
19
Source : InstructionKey.cs
with MIT License
from GrapeCity
with MIT License
from GrapeCity
public override int GetHashCode()
{
return _member.GetHashCode() ^ (int)_code ^ typeof(InstructionKey).GetHashCode();
}
19
Source : AbcConst.cs
with MIT License
from GrapeCity
with MIT License
from GrapeCity
public override int GetHashCode()
{
int h = typeof(T).GetHashCode();
object obj = Value;
if (obj != null)
h ^= obj.GetHashCode();
return h;
}
19
Source : AnyOfIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = typeof(AnyOfIntent).GetHashCode();
hashCode = (hashCode * 397) ^ Subschemas.GetCollectionHashCode();
return hashCode;
}
}
19
Source : MinLengthIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ Value.GetHashCode();
return hashCode;
}
}
19
Source : PropertiesIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
foreach (var property in Properties)
{
hashCode = (hashCode * 397) ^ property.Key.GetHashCode();
hashCode = (hashCode * 397) ^ property.Value.GetHashCode();
}
return hashCode;
}
}
19
Source : PropertyNamesIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = typeof(PropertyNamesIntent).GetHashCode();
hashCode = (hashCode * 397) ^ Context.GetHashCode();
return hashCode;
}
}
19
Source : RefIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ Reference.GetHashCode();
return hashCode;
}
}
19
Source : RequiredIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ RequiredProperties.GetCollectionHashCode();
return hashCode;
}
}
19
Source : DefsIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
foreach (var property in Definitions)
{
hashCode = (hashCode * 397) ^ property.Key.GetHashCode();
hashCode = (hashCode * 397) ^ property.Value.GetHashCode();
}
return hashCode;
}
}
19
Source : EnumIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ Names.GetCollectionHashCode();
return hashCode;
}
}
19
Source : FormatIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ Format.GetHashCode();
return hashCode;
}
}
19
Source : ItemsIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ Context.GetHashCode();
return hashCode;
}
}
19
Source : TypeIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = GetType().GetHashCode();
hashCode = (hashCode * 397) ^ Type.GetHashCode();
return hashCode;
}
}
19
Source : AdditionalPropertiesIntent.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = typeof(AdditionalPropertiesIntent).GetHashCode();
hashCode = (hashCode * 397) ^ Context.GetHashCode();
return hashCode;
}
}
19
Source : SchemaGenerationContextCache.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
return ((Type?.GetHashCode() ?? 0) * 397) ^ Hash;
}
}
19
Source : SchemaGeneratorContext.cs
with MIT License
from gregsdennis
with MIT License
from gregsdennis
public override int GetHashCode()
{
unchecked
{
var hashCode = Type.GetHashCode();
hashCode = (hashCode * 397) ^ (Attributes?.GetAttributeSetHashCode() ?? 0);
return hashCode;
}
}
19
Source : Notification.cs
with MIT License
from grofit
with MIT License
from grofit
public override int GetHashCode()
{
return typeof(T).GetHashCode() ^ 8510;
}
19
Source : BindingTreeViewDataSource.cs
with MIT License
from gucheng0712
with MIT License
from gucheng0712
public override int GetHashCode()
{
return HashUtility.CombineHash(GroupName != null ? GroupName.GetHashCode() : 0, Type != null ? Type.GetHashCode() : 0, Path != null ? Path.GetHashCode() : 0);
}
19
Source : CompleteWorkflowDecision.cs
with Apache License 2.0
from gurmitteotia
with Apache License 2.0
from gurmitteotia
public override int GetHashCode()
{
return string.IsNullOrEmpty(_result) ? GetType().GetHashCode() : _result.GetHashCode() ^ Proposal.GetHashCode();
}
19
Source : TypeSerializable.cs
with MIT License
from guplem
with MIT License
from guplem
public override int GetHashCode()
{
return SystemType != null ? SystemType.GetHashCode() : 0;
}
19
Source : CancelWorkflowDecision.cs
with Apache License 2.0
from gurmitteotia
with Apache License 2.0
from gurmitteotia
public override int GetHashCode()
{
return string.IsNullOrEmpty(_details) ? GetType().GetHashCode() : _details.GetHashCode();
}
19
Source : FixedTypeKeyHashTable.cs
with MIT License
from hadashiA
with MIT License
from hadashiA
public TValue Get(Type type)
{
var hashCode = type.GetHashCode();
var buckets = table[hashCode & indexFor];
if (buckets == null) goto ERROR;
if (buckets[0].type == type)
{
return buckets[0].value;
}
for (int i = 1; i < buckets.Length; i++)
{
if (buckets[i].type == type)
{
return buckets[i].value;
}
}
ERROR:
throw new KeyNotFoundException("Type was not dound, Type: " + type.FullName);
}
19
Source : FixedTypeKeyHashTable.cs
with MIT License
from hadashiA
with MIT License
from hadashiA
public bool TryGet(Type type, out TValue value)
{
var hashCode = type.GetHashCode();
var buckets = table[hashCode & indexFor];
if (buckets == null) goto END;
if (buckets[0].type == type)
{
value = buckets[0].value;
return true;
}
for (int i = 1; i < buckets.Length; i++)
{
if (buckets[i].type == type)
{
value = buckets[i].value;
return true;
}
}
END:
value = default(TValue);
return false;
}
19
Source : CurveKey.cs
with MIT License
from hai-vr
with MIT License
from hai-vr
public override int GetHashCode()
{
unchecked
{
var hashCode = (Path != null ? Path.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (PropertyName != null ? PropertyName.GetHashCode() : 0);
return hashCode;
}
}
19
Source : ProviderRegistry.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public int GetHashCode(KeyValuePair<Type, string> obj)
{
return obj.Key.GetHashCode() * obj.Value.GetHashCode();
}
19
Source : SerializerSpecification.cs
with Apache License 2.0
from HanJunJun
with Apache License 2.0
from HanJunJun
public override int GetHashCode()
{
// TargetCollectionTraits is always derived from TargetType
return this.TargetType.GetHashCode() ^ this.SerializerTypeName.GetHashCode() ^ this.SerializerTypeNamespace.GetHashCode();
}
19
Source : SerializationTarget.cs
with Apache License 2.0
from HanJunJun
with Apache License 2.0
from HanJunJun
public override int GetHashCode( KeyValuePair<string, Type> obj )
{
return ( obj.Key == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode( obj.Key ) ) ^ ( obj.Value == null ? 0 : obj.Value.GetHashCode() );
}
See More Examples