ヽ三・w・三ノ XDocumentの文字列出力ではまるの巻

XDocument xDoc = new XDocument();
// 省略

Response.ContentType = "text/xml";

Response.Write(new XDeclaration("1.0", "utf-8", "yes").ToString());

StringWriter writer = new StringWriter();
xDoc.Save(writer);

Response.Write(writer.GetStringBuilder().ToString());



現在のエンコードから指定したエンコードへの切り替えはサポートしていません。リソース 'http://localhost/LightPlayer/GetPlayListNames.aspx' の実行エラーです。ライン 1、位置 57


Response.Write(xDoc.ToString());
でとりあえず回避したけどなんか微妙な気分……