<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>RSinteract Development Blog &#187; msdn</title>
	<atom:link href="http://rsinteract.wordpress.com/tag/msdn/feed/" rel="self" type="application/rss+xml" />
	<link>http://rsinteract.wordpress.com</link>
	<description>Extending SQL Server Reporting Services to end-users</description>
	<lastBuildDate>Fri, 27 Jan 2012 18:31:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rsinteract.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>RSinteract Development Blog &#187; msdn</title>
		<link>http://rsinteract.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rsinteract.wordpress.com/osd.xml" title="RSinteract Development Blog" />
	<atom:link rel='hub' href='http://rsinteract.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Obsolete Attribute and XML Serialization</title>
		<link>http://rsinteract.wordpress.com/2008/12/08/obsolete-attribute-and-xml-serialization/</link>
		<comments>http://rsinteract.wordpress.com/2008/12/08/obsolete-attribute-and-xml-serialization/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 09:44:55 +0000</pubDate>
		<dc:creator>RSinteract</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[RSinteract]]></category>
		<category><![CDATA[.net3.5]]></category>
		<category><![CDATA[msdn]]></category>

		<guid isPermaLink="false">http://rsinteract.electricbiro.co.uk/?p=18</guid>
		<description><![CDATA[1: public class MyClass 2: { 3: private string _internalProperty; 4: private string _newProperty; 5: 6: [Obsolete("This is no longer required, but needed for backwards compatability")] 7: public string Property 8: { 9: get { return _internalProperty; } 10: set { _internalProperty = value; } 11: } 12: 13: public string NewProperty 14: { 15: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rsinteract.wordpress.com&amp;blog=19131658&amp;post=18&amp;subd=rsinteract&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div style="font-size:8pt;overflow:auto;width:98.97%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> MyClass</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">string</span> _internalProperty;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>     <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">string</span> _newProperty;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>     [Obsolete(<span style="color:#006080;">"This is no longer required, but needed for backwards compatability"</span>)]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> Property</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>         get { <span style="color:#0000ff;">return</span> _internalProperty; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>         set { _internalProperty = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> NewProperty</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span>         get { <span style="color:#0000ff;">return</span> _newProperty; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span>         set { _newProperty = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  18:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  19:</span> }</pre>
<p>&nbsp;</p>
</div>
</div>
<p>This is an interesting little anomaly in the way XML Serialization handles the “Obsolete” attribute on class properties when serializing to and from XML. The attribute is treated as an “XmlIgnore” attribute, meaning that the property is not serialized. It is <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx">well documented</a> that adding the aforementioned attribute to a property in .NET 3.5 will cause this behavior, however, it is not mentioned in the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer(VS.80).aspx">same MSDN page for .NET 2.0</a> on the same subject.</p>
<p>This one caught me out. Apparently the only two ways to fix it are: to take the attributes off or use the “ShouldSerializeX” method constructs as demonstrated below…</p>
<p>&nbsp;</p>
<div style="font-size:8pt;overflow:auto;width:99.01%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">bool</span> ShouldSerializeProperty()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> }</pre>
<p>&nbsp;</p>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rsinteract.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rsinteract.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rsinteract.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rsinteract.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rsinteract.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rsinteract.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rsinteract.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rsinteract.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rsinteract.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rsinteract.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rsinteract.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rsinteract.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rsinteract.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rsinteract.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rsinteract.wordpress.com&amp;blog=19131658&amp;post=18&amp;subd=rsinteract&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rsinteract.wordpress.com/2008/12/08/obsolete-attribute-and-xml-serialization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/812269b1933cf80f651b40754de96551?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rsinteract</media:title>
		</media:content>
	</item>
	</channel>
</rss>
