c# - Deepclone issue with child object need deep serializing -
i've got issue when implementing deepclone serialization/deserialization way. fact: want class owndataset have deepclone instance, 2 below common procedures - constructor , getobjectdata declared:
protected owndataset(serializationinfo info, streamingcontext context) : base(info, context) { dstype = datasettype.standard; attributes = new ownattributelist( (list<ownattribute>) info.getvalue("attributes", typeof (list<ownattribute>))); islinkedds = info.getboolean("islinkedds"); pcaforscores = (pca)info.getvalue("pcaforscores", typeof(pca)); levels = (string[])info.getvalue("levels", typeof(string[])); } [securitypermission(securityaction.demand, serializationformatter = true)] public override void getobjectdata(serializationinfo info, streamingcontext context) { base.getobjectdata(info, context); info.addvalue("attributes", new list<ownattribute>(attributes), typeof(list<ownattribute>)); info.addvalue("islinkedds", islinkedds); info.addvalue("pcaforscores", pcaforscores); info.addvalue("levels", levels); }
please noticed owndataset has properities. 1 of them named "attributes", type ownattributelist - collection of ownattribute objects. when calling deepclone instance of owndataset, in constructor, properties type simple such islinkedds (boolean), levels (string[]) ... got out successfully. ok. more complex typed object, such atttributes (typed ownattributelist), got out incorrectly (number of element in collection still right each of elements null) ! experienced in case please me or give me hints. forgot ? attention & waiting help.
Comments
Post a Comment