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

            if (FormatKey.Length != 0)
            {
                hash ^= FormatKey.GetHashCode();
            }
            hash ^= formatParam_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        /// <summary>
        /// 设置格式Key
        /// </summary>
        /// <param name="strFormate"></param>
        private void SetFormateKey(string strFormate)
        {
            int startIndex = 0;
            int beginIndex = strFormate.IndexOf('{', startIndex);

            while (beginIndex >= 0)
            {
                int       endIndex  = strFormate.IndexOf('}', startIndex);
                var       key       = strFormate.Substring(beginIndex, (endIndex - beginIndex) + 1);
                FormatKey formatKey = new FormatKey
                {
                    key        = key,
                    beginIndex = beginIndex,
                    endIndex   = endIndex
                };
                keys.Add(formatKey);
                startIndex = endIndex + 1;
                beginIndex = strFormate.IndexOf('{', startIndex);
            }
        }