string转xml 忽略根节点
private static T XmlDeSerialize<T>(string xmlStr) where T : class
{
try
{
using var sr = new StringReader(xmlStr);
var serializer = new XmlSerializer(typeof(T), new XmlRootAttribute("xml"));
return (serializer.Deserialize(sr) as T)!;
}
catch (Exception)
{
return default!;
}
}