1

Possible Duplicate:
XML Serialization and namespace prefixes
XmlSerializer property converter

The question is how to create a custom TypeConverter for a type such as Boolean when de/serializing Xml in C#?

<Root>
  <Flag>True</Flag>
</Root>

Currently this does not work because the value 'True' has a capital letter. I want the TypeConverter to take care of converting value to a Boolean.

I know there are a couple ways to achieve this, but I need it as a general solution.

Community
  • 1
  • 1
chafnan
  • 457
  • 1
  • 7
  • 13
  • I'm not aware that `TypeConverter` has anything to do with XML Serialization. "True" is simply not a valid boolean value in XML. It would be a perfectly valid string, but it's not a boolean value. – John Saunders Jun 23 '10 at 14:41
  • The idea is that I want the value to be converted to a boolean value. I want to use the converter to define how the string in XML can be converted to the bool value. Edit: I should define that I want to use the converter in multiple places in my serialization. – chafnan Jun 23 '10 at 14:43

0 Answers0