/// <inheritdoc />
    public override int GetHashCode()
    {
        var hashCode = 493849952;

        hashCode = (hashCode * -1521134295) + Lifetime.GetHashCode();
        hashCode = (hashCode * -1521134295) + EqualityComparer <Type> .Default.GetHashCode(ServiceType);

        if (ImplementationType is not null)
        {
            hashCode = (hashCode * -1521134295) + EqualityComparer <Type?> .Default.GetHashCode(ImplementationType);
        }

        if (ImplementationInstance is not null)
        {
            hashCode = (hashCode * -1521134295) + EqualityComparer <object?> .Default.GetHashCode(ImplementationInstance);
        }

        if (ImplementationFactory is not null)
        {
            hashCode = (hashCode * -1521134295) +
                       EqualityComparer <Func <IServiceProvider, object>?> .Default.GetHashCode(ImplementationFactory);
        }

        return(hashCode);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取哈希码。
 /// </summary>
 /// <returns>返回整数值。</returns>
 public override int GetHashCode()
 => Lifetime.GetHashCode() ^ TryAdd.GetHashCode();