如何从以特定方式格式化的字符串之间访问特定值c# m48333189002
如何在此字符串之间访问值m48333189002如何从以特定方式格式化的字符串之间访问特定值c# m48333189002,c#,deserialization,C#,Deserialization,如何在此字符串之间访问值m48333189002 请提供帮助。最简单的方法可能是使用string.Split方法。最简单的方法可能是使用string.Split方法。您可以尝试解析XML: <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">m48333189002</string> 您可以尝试解析XML: <string xmlns="http://schemas.micro
请提供帮助。最简单的方法可能是使用string.Split方法。最简单的方法可能是使用string.Split方法。您可以尝试解析XML:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">m48333189002</string>
您可以尝试解析XML:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">m48333189002</string>
我想你是在期待下面这样的 导入:
XElement.Parse(str).Value
using System.Xml;
using System.Xml.Linq;
代码:
XElement.Parse(str).Value
using System.Xml;
using System.Xml.Linq;
string xmlResult=“m48333189002”;
//将样本结果放入流中
ascienceoding encoding=新的ascienceoding();
byte[]xmlBytes=encoding.GetBytes(xmlResult);
//从字节数组创建流
MemoryStream ms=新的MemoryStream(xmlBytes);
//读取并反序列化xml
XmlTextReader respXmlRdr=新的XmlTextReader(毫秒);
//从名称空间提取返回值的Linq到XML
//返回XML字符串
XDocument xDoc=XDocument.Load(respXmlRdr);
字符串结果=xDoc.Root.Value;
控制台写入线(结果);
我想你期待的是如下所示
导入:
XElement.Parse(str).Value
using System.Xml;
using System.Xml.Linq;
代码:
XElement.Parse(str).Value
using System.Xml;
using System.Xml.Linq;
string xmlResult=“m48333189002”;
//将样本结果放入流中
ascienceoding encoding=新的ascienceoding();
byte[]xmlBytes=encoding.GetBytes(xmlResult);
//从字节数组创建流
MemoryStream ms=新的MemoryStream(xmlBytes);
//读取并反序列化xml
XmlTextReader respXmlRdr=新的XmlTextReader(毫秒);
//从名称空间提取返回值的Linq到XML
//返回XML字符串
XDocument xDoc=XDocument.Load(respXmlRdr);
字符串结果=xDoc.Root.Value;
控制台写入线(结果);
这是一次性字符串还是较大文件的一部分?这是一次性字符串还是较大文件的一部分?var str=@“m48333189002”代码>不错。永远不要尝试使用子字符串、拆分或正则表达式单独解析xml。var str=@“m48333189002”代码>不错。永远不要尝试使用子字符串、拆分或正则表达式单独解析xml。