示例#1
0
        /// <summary>
        /// Internal set field routine.
        /// </summary>
        /// <param name="fieldName">Name.</param>
        /// <param name="val">Value.</param>
        /// <returns>This builder.</returns>
        private IBinaryObjectBuilder SetField0(string fieldName, BinaryBuilderField val)
        {
            if (_vals == null)
            {
                _vals = new SortedDictionary <string, BinaryBuilderField>();
            }

            _vals[fieldName] = val;

            return(this);
        }
示例#2
0
        /// <summary>
        /// Writes the specified field.
        /// </summary>
        private static void WriteField(Context ctx, BinaryBuilderField field)
        {
            var action = field.WriteAction;

            if (action != null)
            {
                action(ctx.Writer, field.Value);
            }
            else
            {
                ctx.Writer.Write(field.Value);
            }
        }
示例#3
0
        /// <summary>
        /// Add field to cache test.
        /// </summary>
        /// <param name="pos">Position.</param>
        /// <param name="val">Value.</param>
        public BinaryBuilderField CacheField <T>(int pos, T val)
        {
            if (_parent._cache == null)
            {
                _parent._cache = new Dictionary <int, BinaryBuilderField>(2);
            }

            var hdr = _obj.Data[pos];

            var field = new BinaryBuilderField(typeof(T), val, hdr, GetWriteAction(hdr, pos));

            _parent._cache[pos] = field;

            return(field);
        }