开发者

Find number of serialized objects

My issue is trying to determine a number of objects created, the开发者_开发问答 objects being serialized from an XML document. The XML document should be set up for simplicity, so any developer can add an additional object and need no further modification to the code. However each of these objects need to be handled/updated seperately, and specifically, some of the objects are of different sub-classes, which need to be handled differently. So what would be my simplest course of action, allowing other to add objects via the XML, but still ensuring the proper logic happenes for each?


This is totally a bad idea, but if you want something constructive...

Model your XML document objects and include some kind of known syntax for you to specify Lambda expressions in it. So if you enter a

 <BinaryExpresion>
     <NodeType>Add</NodeType>
     <Left>3</Left>
     <Right>4</Right>
 </BinaryExpression>

Then when you read and compile the expression, you could run that code against the data if the XML object and do something (in this case, executing 3 + 4)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜