Share Link
Copied to clipboard
Embed on Your Page
Copied to clipboard
We Stand with Ukraine
[Fork] https://stackoverflow.com/questions/75912029/easiest-way-to-serialize-an-iparsablet-as-a-string-using-the-datacontract-mode by dbc_MinLength
Environment version: .NET 9.0.0 (9.0.0), Unix 6.8.0.1014

<?xml version="1.0" encoding="utf-16"?>
<ParsableSurrogateOfMyTypeMTRdQN6P xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
  <TextValue>{"Value1":"hello","Value2":"there"}</TextValue>
</ParsableSurrogateOfMyTypeMTRdQN6P>

<?xml version="1.0" encoding="utf-16"?>
<Model xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
  <MyTypes>
    <MyType>
      <TextValue>{"Value1":"hello","Value2":"there"}</TextValue>
    </MyType>
    <MyType i:nil="true" />
    <MyType>
      <TextValue>{"Value1":"foo","Value2":"bar"}</TextValue>
    </MyType>
  </MyTypes>
</Model>
Cached Result
Last Run: 6:02:56 pm
Compile: 0.024s
Execute: 0.18s
Memory: 17.97Mb
CPU: 0.204s