예제 #1
0
 public override string ToString()
 {
     if (FormatString != null && FormatString.Any())
     {
         return($"{Type} \"{Value}\" AS ({FormatString.Select(e => e.ToString()).Aggregate((e, f) => e + "," + f)})");
     }
     return($"{Type} {Value}");
 }
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (Kind != null ? Kind.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FormatString.Any() ? FormatString.Select(f => f.Item1.GetHashCode() ^ f.Item2.GetHashCode()).Aggregate((e, f) => e ^ f) : 0);
         hashCode = (hashCode * 397) ^ (TargetFormatterName != null ? TargetFormatterName.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public bool Equals(CallFormatterDocumentItem other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

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

            return(base.Equals(other) &&
                   TargetFormatterName == other.TargetFormatterName &&
                   FormatString.Length == other.FormatString.Length &&
                   FormatString.Select((item, index) => Tuple.Create(item, other.FormatString[index]))
                   .All(e => e.Item1.Item1.Equals(e.Item1.Item1) && e.Item1.Item2.Equals(e.Item2.Item2)));
        }