<?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: My first Extension Method for Object</title>
	<atom:link href="http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/</link>
	<description></description>
	<lastBuildDate>Mon, 15 Mar 2010 06:02:02 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Link Post For August 7 2008 &#124; One .Net Way</title>
		<link>http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/comment-page-1/#comment-29223</link>
		<dc:creator>Link Post For August 7 2008 &#124; One .Net Way</dc:creator>
		<pubDate>Thu, 07 Aug 2008 00:42:51 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/#comment-29223</guid>
		<description>[...] My first Extension Method for Object (Chris Brandsma) [...]</description>
		<content:encoded><![CDATA[<p>[...] My first Extension Method for Object (Chris Brandsma) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Brandsma</title>
		<link>http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/comment-page-1/#comment-29041</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Mon, 04 Aug 2008 16:08:13 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/#comment-29041</guid>
		<description>Mainly that it does work with Struts.

Here is another example.   You are loading a TreeView, every tree node has it&#039;s tag set to a number.  You catch the AfterSelect event and do this:

private void BuildingStructureTreeView_AfterSelect(object sender, TreeViewEventArgs e)
{
	var value =  e.Node.Tag.CastOrDefault());
}

That said, the &quot;as &quot; will work for most cases.</description>
		<content:encoded><![CDATA[<p>Mainly that it does work with Struts.</p>
<p>Here is another example.   You are loading a TreeView, every tree node has it&#8217;s tag set to a number.  You catch the AfterSelect event and do this:</p>
<p>private void BuildingStructureTreeView_AfterSelect(object sender, TreeViewEventArgs e)<br />
{<br />
	var value =  e.Node.Tag.CastOrDefault());<br />
}</p>
<p>That said, the &#8220;as &#8221; will work for most cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/comment-page-1/#comment-29038</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 04 Aug 2008 15:56:07 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/08/04/my-first-extension-method-for-object/#comment-29038</guid>
		<description>Except for structs what is different with just using as?

   1: private Label GetLabel(string name)

   2: {

   3:    return this.Controls[name] as Label;

   4: }</description>
		<content:encoded><![CDATA[<p>Except for structs what is different with just using as?</p>
<p>   1: private Label GetLabel(string name)</p>
<p>   2: {</p>
<p>   3:    return this.Controls[name] as Label;</p>
<p>   4: }</p>
]]></content:encoded>
	</item>
</channel>
</rss>
