<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>DataContractSerializer.ReadObject is easily confused.</title><link>http://msmvps.com/blogs/peterritchie/archive/2009/04/29/datacontractserializer-readobject-is-easily-confused.aspx</link><description>With WCF services you need to declare contracts and generate contract classes that encapsulate those contracts.&amp;#160; Most of the time you can simply let the framework deal with whatever it needs to do to deal with these objects.&amp;#160; Sometimes, you</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: DataContractSerializer.ReadObject is easily confused.</title><link>http://msmvps.com/blogs/peterritchie/archive/2009/04/29/datacontractserializer-readobject-is-easily-confused.aspx#1702590</link><pubDate>Fri, 17 Jul 2009 13:58:24 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1702590</guid><dc:creator>Halo</dc:creator><description>&lt;p&gt;Actually your problem is that you&amp;#39;re calling MemoryStream.GetBuffer() which gets the raw underlying buffer used by the MemoryStream complete with padding. &amp;nbsp;You should be using MemoryStream.ToArray() instead which returns a byte[] that is truncated to the length of the stream. &amp;nbsp;Basically it does what you&amp;#39;re already doing, except that it&amp;#39;s built-in.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1702590" width="1" height="1"&gt;</description></item></channel></rss>