0
XElement XName을 읽을 수있는 형식으로 변경하려하지만 기울일 수 없습니다. XElement 이름을 별칭 이름으로 바꾸는 방법 아래는 내 XElement 코드입니다. XName이 "CreatedDate"의 장소에서 C#에서 XElement 이름을 변경하는 방법
var root = new XElement("Reports",
from l in _userReportMasterDataList
join m in _userReportLocalDataList on l.UsrID equals m.TypeValue
select new XElement("Report",
new XElement("CreatedDate", (DateTime)(l.CreatedDate)),
new XElement("LogType", (string)(l.LogType)),
new XElement("LoginID", (string)(l.LoginID)),
new XElement("Name", (string)(m.Name)),
new XElement("AppVersion", (string)(l.AppVersion)),
new XElement("System", (string)(l.System)),
new XElement("UserIP", (string)(l.UserIPAddress)),
new XElement("LoginDate", (DateTime?)(l.LoginDate)),
new XElement("LogoutDate", (DateTime?)(l.LogoutDate)),
new XElement("Remarks", (string)(l.Remarks))), new XElement("Header",
new XElement("ReportID", (string)(r.ReportID)),
new XElement("GroupingColumn1", (string)(r.GroupingColumn1)),
new XElement("PrintedBy", (string)(r.ReqHdr.Server)),
new XElement("PrintedDate", (DateTime)(DateTime.UtcNow))));
, 나는
XElement 이름은 XML 표준을 따릅니다. 요소 이름에 공백을 포함 할 수 없습니다. 그러나 속성을 사용하여 요소 이름에 대한 설명을 넣을 수 있습니다. – CodeNotFound
@CodeNotFound : 위의 코드에서 wrt 속성을 어떻게 사용할 수 있습니까? 예를 올리시겠습니까? 감사! –
필요한 XElement 생성자마다 새로운 XAttribute를 추가하십시오. – CodeNotFound