public TarsStructBase DirectRead(TarsStructBase o, int tag, bool isRequire)
        {
            TarsStructBase reff = null;

            if (SkipToTag(tag))
            {
                try
                {
                    reff = o.NewInit();
                }
                catch (Exception e)
                {
                    throw new TarsDecodeException(e.Message);
                }
                var hd = new HeadData();
                ReadHead(hd);
                if (hd.Type != TarsStructBase.STRUCT_BEGIN)
                {
                    throw new TarsDecodeException("type mismatch.");
                }
                reff.ReadFrom(this);
                SkipToStructEnd();
            }
            else if (isRequire)
            {
                throw new TarsDecodeException("require field not exist.");
            }
            return(reff);
        }
        public TarsStructBase ReadTarsStructBase(Type type, int tag, bool isRequire)
        {
            TarsStructBase reff = null;

            if (SkipToTag(tag))
            {
                try
                {
                    reff = (TarsStructBase)Activator.CreateInstance(type);
                }
                catch (Exception e)
                {
                    throw new TarsDecodeException(e.Message);
                }

                var hd = new HeadData();
                ReadHead(hd);
                if (hd.Type != TarsStructBase.STRUCT_BEGIN)
                {
                    throw new TarsDecodeException("type mismatch.");
                }
                reff.ReadFrom(this);
                SkipToStructEnd();
            }
            else if (isRequire)
            {
                throw new TarsDecodeException("require field not exist.");
            }
            return(reff);
        }