Question
Given a serializeable Class with lots of Properties to serialize, I want some of them to be an Attribute of an another one.
Sample
Serialize a Class like that
[Serializeable]
public class MySerializeableClass {
public string AnyPath { get; set; }
public bool IsActive { get; set; }
}
The result would be
<MySerializeableClass>
<AnyPath>C:\</AnyPath>
<IsActive>true</IsActive>
</MySerializeableClass>
But it should be
<MySerializeableClass>
<AnyPath IsActive="true">C:\</AnyPath>
</MySerializeableClass>
Requirements
I have read here that I could achieve that by creating some (propably generic) classes. This would induce lots of extra Code, especially because there's no recognizeable order in the serialisation Structure (it's a defined standard). Means that making it generic would making it even more complicated than in the above added link - that's why I want to avoid this and why I came here.
So in general i am looking for a solution using attributes. But I am also open to other possible solutions.
EDIT:
Just to clarify, I already knew the possibility of creating classes to solve this problem. I posed this Question because I want to avoid that and I don't know how.