コード例 #1
0
        internal Label(IJsonLabel json, TrelloAuthorization auth)
        {
            Id       = json.Id;
            _context = new LabelContext(Id, auth);
            _board   = new Field <Board>(_context, nameof(Board));
            _color   = new Field <LabelColor?>(_context, nameof(Color));
            _color.AddRule(EnumerationRule <LabelColor?> .Instance);
            _name = new Field <string>(_context, nameof(Name));
            _uses = new Field <int?>(_context, nameof(Uses));

            _context.Merge(json);
        }
コード例 #2
0
        public int GetHashCode(IJsonLabel obj)
        {
            if (obj == null)
            {
                return(0);
            }

            unchecked
            {
                var hashCode = Instance.GetHashCode(obj.Board);
                hashCode = (hashCode * 397) ^ obj.Color.GetHashCode();
                hashCode = (hashCode * 397) ^ (obj.Id?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ (obj.Name?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ obj.Uses.GetHashCode();
                return(hashCode);
            }
        }
コード例 #3
0
        public bool Equals(IJsonLabel x, IJsonLabel y)
        {
            if (x == null && y != null)
            {
                return(false);
            }
            if (x != null && y == null)
            {
                return(false);
            }
            if (x == null)
            {
                return(true);
            }

            return(Instance.Equals(x.Board, y.Board) &&
                   x.Color == y.Color &&
                   x.Id == y.Id &&
                   x.Name == y.Name &&
                   x.Uses == y.Uses);
        }