It seems like that XmlTyp(AnonymousType = true) is not supported.
public class ClassA
{
public string ElementA { get; set; } = "TextA";
public ClassB B { get; set; } = new ClassB();
}
[XmlType(AnonymousType = true)]
public class ClassB
{
public string ElementB { get; set; } = "TextB";
}
I want to prevent <B><ElementB>TextB</ElementB></B> and just get <ElementB>TextB</ElementB> inside ClassA. Is there another way to achieve this? I have to say, I don't like the standard Xml Serializer solution, because if I need a class C which should have Class B fully inside and not just his members, then I have to create a duplicate class for B but without the "AnonymousType" tag, that's why I would favour a member tag like XmlElement to be more flexible.
It seems like that XmlTyp(AnonymousType = true) is not supported.
I want to prevent
<B><ElementB>TextB</ElementB></B>and just get<ElementB>TextB</ElementB>inside ClassA. Is there another way to achieve this? I have to say, I don't like the standard Xml Serializer solution, because if I need a class C which should have Class B fully inside and not just his members, then I have to create a duplicate class for B but without the "AnonymousType" tag, that's why I would favour a member tag like XmlElement to be more flexible.