Expand|Select|Wrap|Line Numbers
- public class ParentClass
- {
- private object _arguments;
- public object Arguments
- {
- get { return _arguments; }
- set { _arguments = vale; }
- }
- }
- public class SomeArguments
- {
- private string _someValue;
- public string SomeValue
- {
- get { return _someValue; }
- set { _someValue = value; }
- }
- }
<?xml version="1.0" encoding="iso-8859-1"?>
<ParentClass>
<Arguments type="SomeArguments">
<SomeValue>blah</SomeValue>
</Arguments>
</ParentClass>
or alternatively:
<?xml version="1.0" encoding="iso-8859-1"?>
<ParentClass>
<Arguments type="SomeArguments">
<SomeArguments>
<SomeValue>blah</SomeValue>
</SomeArguments>
</Arguments>
</ParentClass>
I can sort of get the first functionality by including a [XmlInclude(typeof(SomeArguments))] tag before the definition of the ParentClass class. The problem is, the ParentClass cannot know the type of Arguments. I need the serialization to recognize the type of any class in Arguments. Is this possible? Thanks in advance.