'how to convert multiple same type xml elements to List<sameType>?

I have xml like this

 <root>
    <parent>
        <sub>
            <img1>
                link
            </img1>
            <img2>
                link
            </img2>
            <img3>
                link
            </img3>
            <img4>
                link
            </img4>
        </sub>
        <sub>
            <img1>
                link
            </img1>
            <img2>
                link
            </img2>
            <img3>
                link
            </img3>
            <img4>
                link
            </img4>
        </sub>
        <sub>
            <img1>
                link
            </img1>
            <img2>
                link
            </img2>
            <img3>
                link
            </img3>
            <img4>
                link
            </img4>
        </sub>
        <sub>
            <img1>
                link
            </img1>
            <img2>
                link
            </img2>
            <img3>
                link
            </img3>
            <img4>
                link
            </img4>
        </sub>
    </parent>
</root>

I want to deserialize img1,img2,img3,img4 to List<string> Images, how can I do this with attributes in c# without creating 4 properties ?

So I need jus List<string> property. But I do not know which attiribute to use.

In generally how to create List for multiple single same type xml elements ?

My english not great, but I think you got the point :). Thank you anyway :) .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source