Ham*_*jan 5 c# xml coding-style declaration utf-8
我想找到一个更好的方法来做到这一点:
XmlNode nodeXML = xmlDoc.AppendChild(
xmlDoc.CreateXmlDeclaration( "1.0", "utf-8", String.Empty) );
Run Code Online (Sandbox Code Playgroud)
当我输入代码时,我不想考虑"utf-8"vs"UTF-8"vs"UTF8"vs"utf8".我想让我的代码更容易出现错别字.我确信某些标准库已声明"utf-8"为const/readonly字符串.我该怎么找到它?那么,"1.0"呢?我假设主要的XML版本也已在某处枚举.
谢谢!
试试Encoding.UTF8.WebName.