I need to populate a class using an XML file.

```xml
<Ship>
    <Name>Base Ship</Name>
    <Owner>PG</Owner>
    <Aim>
        <Type>base</Type>
        <Value>10</Value>
        <Last>-1</Last>
    </Aim>
    <Aim>
        <Type>cannon</Type>
        <Value>10</Value>
        <Last>2</Last>
    </Aim>
    <Dodge>
        <Type>base</Type>
        <Value>10</Value>
        <Last>-1</Last>
    </Dodge>
    <EmPower>
        <Type>base</Type>
        <Value>10</Value>
        <Last>-1</Last>
    </EmPower>
</Ship>

```

My problem is how to populate a `Dictionary<string, CustomStruct>`

This is the `struct`:

```
public struct Stat
{
    public int StatValue { get; set; }
    public int StatLast { get; set; }

    public Stat(int statValue, int statLast)
    {
        StatValue = statValue;
        StatLast = statLast;
    }
}

```

My LINQ query looks like this:

```
string loadDataPath = Application.persistentDataPath + "/saveData.xml";
XDocument loadData = XDocument.Load(loadDataPath);

var query = from item in loadData.Elements("Ship")
            select new Ship()
            {
                Name = (string) item.Element("Name"),
                Owner = (string) item.Element("Owner"),
                Aim = item.Elements("Aim") // <-- Here lies the problem.
                // ...
            };

```

For each Aim `XElements` I need to populate the Aim dictionary using the following method:

```none
Aim TKey = XML Type
Aim TValue.StatValue = XML Value
Aim TValue.StatLast = XML Last

```