Problema rescriere date xml

Discutii despre tot ce nu se incadreaza in celelalte categorii.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
User avatar
sergiu4995
Membru eXtream
Membru eXtream
Posts: 2052
Joined: 08 Oct 2011, 21:05
Detinator Steam: Da
Has thanked: 31 times
Been thanked: 17 times
Contact:

03 Oct 2017, 23:43

Incerc sa fac ceva cu xml .
Ideea e ca vreau cand scriu de la tastura niste orase,sa nu mi se rescriere orasul ,adica pun Bacau,apoi pun Iasi,sa fie o lista
<Tur>

<Tara>
<Oras>Bacau</Oras>
</Tara>

<Tara>
<Oras>Iasi</Oras>
</Tara>

</Tur>
Dar imi rescriere ce pun de la tastura in xml
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace ConsoleApplication9
{
class Program
{
static void Main(string[] args)
{


sergiu ab = new sergiu();
XDocument xml = new XDocument(
new XElement("tur",ab.asa())
);
xml.Save("data.xml");
Console.ReadKey();
}

public class sergiu
{
string a { get; set; }
public void asaa()
{




a = Console.ReadLine();
new XElement("Tara",
new XElement("Oras", a)
);


}
public string
asa()
{
for (int i = 0; i <= 4; i++)
{
asaa();
}

return a;


}
}
}
}
Post Reply

Return to “Discutii generale”

  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 422 guests