예제 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = Type.GetHashCode() * 397;
         hash = hash ^ (IsTypeNullable?.GetHashCode() ?? 0 * 11);
         hash = hash ^ (IsElementTypeNullable?.GetHashCode() ?? 0 * 13);
         return(hash);
     }
 }
예제 #2
0
        public bool Equals(ISyntaxTypeReference other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Type.IsEqualTo(other.Type) &&
                   Context == other.Context &&
                   IsTypeNullable.Equals(other.IsTypeNullable) &&
                   IsElementTypeNullable.Equals(other.IsElementTypeNullable));
        }
        public bool Equals(ISchemaTypeReference other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (Type == other.Type ||
                (Type is IType a && other.Type is IType b && a.IsEqualTo(b)))
            {
                return(Context == other.Context &&
                       IsTypeNullable.Equals(other.IsTypeNullable) &&
                       IsElementTypeNullable.Equals(other.IsElementTypeNullable));
            }

            return(false);
        }
예제 #4
0
        public bool Equals(IClrTypeReference other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (Context != other.Context &&
                Context != TypeContext.None &&
                other.Context != TypeContext.None)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   IsTypeNullable.Equals(other.IsTypeNullable) &&
                   IsElementTypeNullable.Equals(other.IsElementTypeNullable));
        }