[씨#] XML 파일의 ID 값 자동 증가
이를 LINQ to XML위해 사용할 수 있습니다. 먼저 현재 요소 수를 가져온 다음 다음과 같이 새 요소를 삽입합니다. var xDoc = XDocument.Load("path"); var count = xDoc.Descendants("user").Count(); var newUser = new XElement("user", new XElement("id", count+1), new XElement("name", nameBox.Text), new XElement("surname", surnameBox.Text), new XElement("weight", weightUpDown.Value), new XElement("height", heightUpDown.Value)); xDoc.Root.Add(newU..