3
I created these two variables to be one array
public static string[] doc { get; set; }
public static string[] doc1 { get; set; }
And I have these two items, where is a list
var xDoc = XDocument.Parse(soapResult, LoadOptions.None)
.Descendants(ns + "ListaNfse")
.Descendants(ns + "CompNfse")
.Descendants(ns + "Nfse")
.Elements(ns + "InfNfse")
.Select(x => new
{
OutrasInformacoes = x.Element(ns + "OutrasInformacoes")?.Value,
Numero = x.Element(ns + "Numero")?.Value,
Codigo = x.Element(ns + "CodigoVerificacao")?.Value,
}).ToList();
var xDoc1 = XDocument.Parse(soapResult, LoadOptions.None)
.Descendants(ns + "ListaNfse")
.Descendants(ns + "CompNfse")
.Descendants(ns + "Nfse")
.Elements(ns + "InfNfse")
.Descendants(ns + "DeclaracaoPrestacaoServico")
.Descendants(ns + "InfDeclaracaoPrestacaoServico")
.Descendants(ns + "Rps")
.Elements(ns + "IdentificacaoRps")
.Select(x => new
{
NumeroRPS = x.Element(ns + "Numero")?.Value,
}).ToList();
How can I play the values of these lists in the array ?
I tried something like:
doc = new string[] { xDoc.ToString() };
doc1 = new string[] { xDoc1.ToString() };
But it didn’t work, how can I play, and then use this array?
I tried it this way, and it returned me the following error: It is not possible to convert implicitly type "<Anonymous type: string Outrasinformacoes, string Numero, string Codigo>[]" into "string[]"
– Mariana
The
xDoc
has 3 properties, it is not possible to convert this directly to aArray
. You can’t put that information togetherstring
? Or which property should go toArray
?– João Martins
I need the 3 guys, how can I get these figures ?
– Mariana
Edited response.
– João Martins
That’s just what I needed, thank you for the answer and the explanation, I understood. Thank you.
– Mariana