asgerhallas
asgerhallas

Reputation: 17734

DataContractSerializer: preserve references

Just a question of curiosity. When i preserve object refernces while serializing an object graph with DataContractSerializer the xml emitted where there are refrences looks like this:

<test z:Ref="1" and i:nil="true" />

Can anybody tell me why it says i:nil="true" here? Why not just the reference?

Upvotes: 3

Views: 960

Answers (2)

John Saunders
John Saunders

Reputation: 161821

This is because the content of the test element is empty. i:nil="true" is necessary so that the content will validate.

Upvotes: 2

Martin Delille
Martin Delille

Reputation: 11790

This is a reference to your element. You must have a definition of your element previously in the document like this :

<test z:Id="1">
    ...
</test>

Upvotes: 0

Related Questions