Question: Take the following example code:

```
public abstract class ElementBase 
{
}

public class ElementOne : ElementBase
{
}

public class ElementTwo : ElementBase
{
    [XmlElement("element-one", typeof(ElementOne))]
    [XmlElement("element-two", typeof(ElementTwo))]
    public ElementBase[] SubElements { get; set; }
}

[XmlRoot("root-element")]
public class RootElement 
{
    [XmlElement("element-one", typeof(ElementOne))]
    [XmlElement("element-two", typeof(ElementTwo))]
    public ElementBase[] SubElements { get; set;}
}

```

The attributes on `ElementOne.SubElements` and `ElementTwo.SubElements` need to stay in sync (i.e., attributes added to one will need to be added to the other, and arguments need to stay the same), The reason for this is that in the xml, `<element-one>` and elements can both appear as subelements to `<root-element>` and `<element-two>`. The elements can be in any order, and the order is important. Also, there will probably be more subelements in the future. The way it is currently coded will make maintenance tedious and error-prone because of the need to maintain two separate places for attributes.

Is there a way to have these attributes "shared" between the two properties, such that a single edit will affect them both? I tried the following:

```
public class CommomAttribute : Attribute
{
    public XmlElementAttribute f = new XmlElementAttribute("element-one", typeof(ElementOne));
    public XmlElementAttribute l = new XmlElementAttribute("element-two", typeof(ElementTwo));
}

```

I then replaced the redundant attributes on the above classes' properties with a single [Command]. This didn't work.

An alternative question: is there a more elegant way to solve this problem?

Answer: 
You can try this if you don't mind having to go one level deeper to get to you sub-element items:

```
public abstract class ElementBase
{
}

public class ElementOne : ElementBase
{
}

public class ElementTwo : ElementBase
{
    public SubElementList SubElements { get; set; }
}

public class SubElementList
{
    [XmlElement("element-one", typeof(ElementOne))]
    [XmlElement("element-two", typeof(ElementTwo))]
    public ElementBase[] Items { get; set; }
}

[XmlRoot("root-element")]
public class RootElement
{
    public SubElementList SubElements { get; set; }
}

```
Off the top of my head, I'd do the following:

1. On the ctor of each class (One and Two), require and instance of ElementBase and keep it as a private attribute (let's say, "SyncingElement")
2. Modify the setter of SubElements, to sync with the instance of "SyncingElement"

This way, SubElements on both objects would have the same memory address (same instance). So, if someone get the instance of SubElements from One modifies the object at index [2] (for example), it would affect SubElements at Two as well.