开发者

XElement with System.Data.Linq.Binary

I am making an XElement with an element that has LINQ.Binary in it..

The line looks like:

new XElement("Data", binData));

Where binData is of type System.Data.Linq.Binary

what I dont understa开发者_如何学Cnd is that when I look at the xml created it shows

<Data>"mydata"</Data>

instead of

<Data>mydata</Data>

why are there quotes and how do I get rid of them.


The reason you are getting "mydata" is because that is what the output of System.Data.Linq.Binary's ToString() method gives you.

This is a simple way to get rid of them, although plenty of others exist:

string bindatastr = binData.ToString();
new XElement("Data", bindatastr.Substring(1, bindatastr.Length - 2));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜