S
S
Samir Kurbanov2020-07-17 09:16:35
C++ / C#
Samir Kurbanov, 2020-07-17 09:16:35

How to convert sheet property to array?

There is such a leaf that I fill out from xml

List<Lpu> mo = doc.Descendants("glpu")
                .Select(x => new Lpu
                {
                    reenom = Convert.ToInt32(x.Element("reenom").Value),
                    name = x.Element("name").Value
                })
                .ToList();

Type properties:
class Lpu
    {
        public int reenom { get; set; }
        public string name { get; set; }
    }


How to create a string[] array that will only contain the name property from List<Lpu> mo?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ayazer, 2020-07-17
@kurbanov_samir

mo.Select(c=>c.name).ToArray()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question