Sunday, August 4, 2013

LINQ to XML - subclassing XElement

hi David,


Perhaps I was not clear in the question, but encapsulation is exactly what I am trying to avoid. I would end up with extra layer which is a mirror of what I have as LINQ XML. At the same time, entire LINQ API is gone or I would have to redo it myself. As alternative I can use dynamic style type checking:



XElement DoSomething(XElement topLevelBlock) {
if (topLevelBLock.Name != W.p &&
topLevelBlock.Name != W.tbl &&
topLevelBlock.Name != W.sdt)
throw ...
}

Unfortunately it is runtime only.


I am not sure what do you mean by XML Serialization in this context. Can you provide an example?


Thanks in advance,


--pawel


No comments:

Post a Comment