是否可以轻松返回 read-only System.Xml.XmlElement
,使其属性和子项无法修改?
我建议应该使用XmlNode.IsReadOnly 。例如,
System.Xml.XmlElement xml = ...;
//this line does not compile because the IsReadOnly property is read only
xml.IsReadOnly = true;
return xml;
是否可以轻松返回 read-only System.Xml.XmlElement
,使其属性和子项无法修改?
我建议应该使用XmlNode.IsReadOnly 。例如,
System.Xml.XmlElement xml = ...;
//this line does not compile because the IsReadOnly property is read only
xml.IsReadOnly = true;
return xml;