public override void GenerateDeserializeIL(MethodGenerator g) { SetMember(g, () => { var array = g.Declare(this.TargetType); if (this.MemberAttribute.IsBlob) { g.Assign(array, () => { SerializationMethodHelper.ReadBlob(g, this.DTOMemberName);//读取数量 }); } else { var length = g.Declare <int>(); g.Assign(length, () => { SerializationMethodHelper.ReadLength(g, this.DTOMemberName);//读取数量 }); g.If(() => { g.Load(length); g.Load(0); return(LogicOperator.LessThan); }, () => { //数量小于1 //array = new array[]; var elementType = this.TargetType.ResolveElementType(); g.Assign(array, () => { g.NewArray(elementType, () => { g.Load(length); }); }); }, () => { var elementType = this.TargetType.ResolveElementType(); //int[] = new int[c]; g.Assign(array, () => { g.NewArray(elementType, () => { g.Load(length); }); }); g.For(length, (index) => { var item = g.Declare(elementType); g.Assign(item, () => { SerializationMethodHelper.ReadElement(g, this.DTOMemberName, elementType, index); }); g.StoreElement(array, index, item); }); }); } g.Load(array); }); }