示例#1
0
        /// <inheritdoc />
        public override int GetHashCode()
        {
            int hashCode = IsFlag.GetHashCode() * 397;

            if (Key != null)
            {
                return(hashCode ^ Key.GetHashCode() * 397);
            }

            return(Values.Aggregate(hashCode, (current, value) => current ^ value.GetHashCode() * 397));
        }
示例#2
0
 /// <summary>
 ///     Returns a hash code for this object.
 /// </summary>
 /// <returns>
 ///     A hash code for this object.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Operand.GetHashCode();
         hashCode = (hashCode * 397) ^ (Values != null
                        ? Values.Aggregate(0, (current, value) => current + ((current * 397) ^ value.GetHashCode()))
                        : 0);
         hashCode = (hashCode * 397) ^ (SubQuery?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
        private string _GetJson(int depth = 0)
        {
            var json    = string.Empty;
            var subJson = Values.Aggregate(string.Empty, (current, value) => current + value._GetJson(depth + 1)).TrimEnd(',', '\n') + "\n";
            var tab     = new string(' ', depth *2);

            switch (NodeType)
            {
            case NodeTypeEnum.File:
                json += $"{tab}{{\"type\":\"{NodeType.ToString().ToLower()}\",\"name\":\"{NodeName}\",\"size\":{Attribute?.Length}}},\n";
                break;

            case NodeTypeEnum.Directory:
                json += $"{tab}{{\"type\":\"{NodeType.ToString().ToLower()}\",\"name\":\"{NodeName}\",\"contents\":[\n{subJson}{tab}]}},\n";
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(json);
        }
 public MeasurementPoint GetPoint(MapPoint point)
 {
     return(Values.Aggregate <MeasurementPoint, MeasurementPoint>
                (null, (current, value) => value.IsSame(point) ? value : current));
 }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override string ToString() =>
 Values.Aggregate(
     "",
     (a, r) => a + r
     );
示例#6
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override int GetHashCode()
 {
     return(Values.Aggregate(17, (current, value) => current * 23 + (value?.GetHashCode() ?? 42)));
 }
 public MeasurementPoint GetPoint(IPoint point, bool includeZ)
 {
     return(Values.Aggregate <MeasurementPoint, MeasurementPoint>
                (null, (current, value) => value.IsSame(point, includeZ) ? value : current));
 }
示例#8
0
 /// <summary>
 /// Преобразует значение в строковое представление
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(Values.Aggregate("", (_array, _value) => _array += _value.ToString()));
 }
示例#9
0
        public override string ToString()
        {
            var values = Values.Aggregate("", (s, value) => $"{s} {value}");

            return($"{Name}:{values}");
        }