コード例 #1
0
        public object CreateMemberInstance()
        {
            Type type;

            if (this._memberType)
            {
                type = this._propertyInfo.PropertyType;
            }
            else
            {
                type = this._fieldInfo.FieldType;
            }

            TTLVCommon.CheckHasNoParaConstructor(type);
            return(Activator.CreateInstance(type));
        }
コード例 #2
0
        private static void DecodingCollection(IList list, BinaryReader br, TTLVStructNode node, int valueLength)
        {
            TTLVCommon.CheckHasNoParaConstructor(node.ElementType);
            var endPosition = br.BaseStream.Position + valueLength;
            var nodeInfo    = new TTLVNodeInfo();

            while (br.BaseStream.Position < endPosition)
            {
                //int tag = br.ReadInt32();
                //TypeCode valueBufferTypeCode = (TypeCode)br.ReadByte();
                //int length = br.ReadInt32();
                _codec.ReadNodeInfo(br, nodeInfo);

                object instance = Activator.CreateInstance(node.ElementType);
                PrimitiveDecoding(br, br.BaseStream.Position + nodeInfo.Length, ref instance, node.Childs);
                list.Add(instance);
            }

            br.BaseStream.Position = endPosition;
        }