私はこのような LINQ クエリを持っています。自動的に追加される XML 宣言タグを削除する必要があります。
var cubbingmessagexml = new XDocument(
new XElement("MESSAGE", new XAttribute("ID", "CUB"),
new XElement("RECORD", new XAttribute("STORENO", cubing.StoreID),
new XAttribute("TPNB", cubing.ProductCode),
new XAttribute("QUANTITY", cubing.Quantity),
new XAttribute("CUBINGTIME", cubing.CubingDateTime.ToString("yyyyMMddHHmmss")),
new XAttribute("SHELFFACING", cubing.ShelfFacing)
)));
xml = cubbingmessagexml.ToString();
助けてください
XML ファイルを保存したくありません。XML を文字列として返す必要があるだけです。