Dynamic naming of attribute

Jan 30, 2012 at 10:09 AM


Say I have a class, that contains a single field - an integer. And I say that this class/field should be an attribute for the parent property. I then have:

<base coordinateId="123" />

Rather than:


<coordinate id="123" />



I now have a class with two coordinates:

<coordinate id="123" />
<coordinate2 id="321" />


I can't, with the current design, put coordinate as an attribute, as the coordinate class determines the attribute name. I'd rather in the Fleet class define the coordinate attribute name. Is this possible?

Feb 1, 2012 at 3:39 PM

As far as I understood from your description, you need to assign attribute names in run-time, not compile-time. For this purpose you can use custom-serializers.

For a sample usage see CustomSerializationTests (class and .cs) in the Sample Classes of the Demo Application.

Anyway, if you provide a piece of code I can help more.

Feb 1, 2012 at 5:01 PM

That's very correct :P

I'll take a peek ;)