<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Last XML serializer I&#8217;ll ever write</title>
	<atom:link href="http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Sun, 19 May 2013 03:22:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Garth</title>
		<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/#comment-203</link>
		<dc:creator>Garth</dc:creator>
		<pubDate>Thu, 04 Dec 2008 10:12:29 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/02/19/last-xml-serializer-i-ll-ever-write.aspx#comment-203</guid>
		<description>Thank you I used this in my code. :)</description>
		<content:encoded><![CDATA[<p>Thank you I used this in my code. <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: XStream</title>
		<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/#comment-202</link>
		<dc:creator>XStream</dc:creator>
		<pubDate>Mon, 25 Feb 2008 21:27:21 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/02/19/last-xml-serializer-i-ll-ever-write.aspx#comment-202</guid>
		<description>use XStream...</description>
		<content:encoded><![CDATA[<p>use XStream&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Bogard</title>
		<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/#comment-201</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Wed, 20 Feb 2008 18:04:22 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/02/19/last-xml-serializer-i-ll-ever-write.aspx#comment-201</guid>
		<description>Ah Ben, but that&#039;s where you&#039;re wrong!  A challenge!

public static string ToXml&lt;T&gt;(this T value)
{
    return Serialize(value);
}

public static T FromXml&lt;T&gt;(this string rawValue)
{
    return Deserialize&lt;T&gt;(rawValue);
}

Generic extension methods! Success!

</description>
		<content:encoded><![CDATA[<p>Ah Ben, but that&#8217;s where you&#8217;re wrong!  A challenge!</p>
<p>public static string ToXml<t>(this T value)<br />
{<br />
    return Serialize(value);<br />
}</p>
<p>public static T FromXml</t><t>(this string rawValue)<br />
{<br />
    return Deserialize</t><t>(rawValue);<br />
}</p>
<p>Generic extension methods! Success!</p>
<p></t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Scheirman</title>
		<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/#comment-200</link>
		<dc:creator>Ben Scheirman</dc:creator>
		<pubDate>Wed, 20 Feb 2008 13:56:40 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/02/19/last-xml-serializer-i-ll-ever-write.aspx#comment-200</guid>
		<description>You could also use this in an object extension method...

someObject.ToXml()

and SomeObjectClass.FromXml();


(you&#039;d have to extend your helper to allow for Type parameters b/c generic calls without knowing the T at compile time is only doable through ugly reflection)</description>
		<content:encoded><![CDATA[<p>You could also use this in an object extension method&#8230;</p>
<p>someObject.ToXml()</p>
<p>and SomeObjectClass.FromXml();</p>
<p>(you&#8217;d have to extend your helper to allow for Type parameters b/c generic calls without knowing the T at compile time is only doable through ugly reflection)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Bogard</title>
		<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/#comment-199</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Wed, 20 Feb 2008 12:46:45 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/02/19/last-xml-serializer-i-ll-ever-write.aspx#comment-199</guid>
		<description>@Steve

Yeah thanks for the heads up on the binary serialization, I always forget about that one too.

@Max

Neither am I normally, but I&#039;m subverting my blog as a personal code repository on this one :)</description>
		<content:encoded><![CDATA[<p>@Steve</p>
<p>Yeah thanks for the heads up on the binary serialization, I always forget about that one too.</p>
<p>@Max</p>
<p>Neither am I normally, but I&#8217;m subverting my blog as a personal code repository on this one <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max Pool</title>
		<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/#comment-198</link>
		<dc:creator>Max Pool</dc:creator>
		<pubDate>Wed, 20 Feb 2008 05:10:10 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/02/19/last-xml-serializer-i-ll-ever-write.aspx#comment-198</guid>
		<description>Well done.  Not a fan of code snippets, but this is one I might put in my pocket...</description>
		<content:encoded><![CDATA[<p>Well done.  Not a fan of code snippets, but this is one I might put in my pocket&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Burman</title>
		<link>http://lostechies.com/jimmybogard/2008/02/20/last-xml-serializer-i-ll-ever-write/#comment-197</link>
		<dc:creator>Steve Burman</dc:creator>
		<pubDate>Wed, 20 Feb 2008 04:58:03 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/02/19/last-xml-serializer-i-ll-ever-write.aspx#comment-197</guid>
		<description>lol - I think I have written this class at least a half-dozen times myself. 

I tend to make mine a single SerializationHelper that can do both Xml and Binary serialization. So I have the following methods as well:

public static byte[] BinarySerialize(object obj)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(ms, obj);
                return ms.ToArray();
            }
        }

        public static T BinaryDeserialize&lt;T&gt;(byte[] data) where T : class
        {
            using (MemoryStream ms = new MemoryStream(data))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                return formatter.Deserialize(ms) as T;
            }
        }

(apologies in advance - as I&#039;m sure the formatting of that code sux as a comment)</description>
		<content:encoded><![CDATA[<p>lol &#8211; I think I have written this class at least a half-dozen times myself. </p>
<p>I tend to make mine a single SerializationHelper that can do both Xml and Binary serialization. So I have the following methods as well:</p>
<p>public static byte[] BinarySerialize(object obj)<br />
        {<br />
            using (MemoryStream ms = new MemoryStream())<br />
            {<br />
                BinaryFormatter formatter = new BinaryFormatter();<br />
                formatter.Serialize(ms, obj);<br />
                return ms.ToArray();<br />
            }<br />
        }</p>
<p>        public static T BinaryDeserialize<t>(byte[] data) where T : class<br />
        {<br />
            using (MemoryStream ms = new MemoryStream(data))<br />
            {<br />
                BinaryFormatter formatter = new BinaryFormatter();<br />
                return formatter.Deserialize(ms) as T;<br />
            }<br />
        }</p>
<p>(apologies in advance &#8211; as I&#8217;m sure the formatting of that code sux as a comment)</t></p>
]]></content:encoded>
	</item>
</channel>
</rss>
