Пример #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Description.Length != 0)
            {
                hash ^= Description.GetHashCode();
            }
            if (createdAt_ != null)
            {
                hash ^= CreatedAt.GetHashCode();
            }
            if (CreatedBy.Length != 0)
            {
                hash ^= CreatedBy.GetHashCode();
            }
            if (modifiedAt_ != null)
            {
                hash ^= ModifiedAt.GetHashCode();
            }
            if (Done != false)
            {
                hash ^= Done.GetHashCode();
            }
            if (metadata_ != null)
            {
                hash ^= Metadata.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.Error)
            {
                hash ^= Error.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.Response)
            {
                hash ^= Response.GetHashCode();
            }
            hash ^= (int)resultCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
        public override int GetHashCode()
        {
            //x return base.GetHashCode();
            //x return new { Id, CreatedAt, ModifiedAt, SoftDelete, Name, Url }.GetHashCode();
            unchecked
            {
                int       hash        = 17;    //x (int)2166136261; //x (int)397;
                const int primeNumber = 23;    //x 16777619;

                //TODO do suitable nullity checks
                hash = hash * primeNumber ^ Id.GetHashCode();
                hash = hash * primeNumber ^ CreatedAt.GetHashCode();
                hash = hash * primeNumber ^ ModifiedAt.GetHashCode();
                hash = hash * primeNumber ^ SoftDelete.GetHashCode();
                hash = hash * primeNumber ^ (Name == null
                                                                                        ? 0
                                                                                        : Name.GetHashCode());
                hash = hash * primeNumber ^ (Url == null
                                                                                        ? 0
                                                                                        : Url.GetHashCode());
                return(hash);
            }
        }