<?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: Different Kind Of Factory?</title>
	<atom:link href="http://davybrion.com/blog/2009/03/different-kind-of-factory/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Wed, 08 Sep 2010 21:03:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: OJ</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9557</link>
		<dc:creator>OJ</dc:creator>
		<pubDate>Sun, 08 Mar 2009 22:50:49 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9557</guid>
		<description>Good question John :) Time for me to show my hand eh? Let me just go dig one up.

To be honest, I think it would vary depending on what was going on. But on the surface I would do exactly what you described in your last comment, though I might not go as far as having a registration mechanism. A simple switch based on type might be all that&#039;s needed.

The crux of my &quot;gripe&quot; (for want of a better word) is that I find the manner in which the code has to be invoked rather unintuitive. If you wrapped up your current mechanism in a factory function I&#039;d be a lot more comfortable with it. You&#039;d have a simple function call through your code instead of foo[bar]();

Having said all that, your post is an interesting snippet of how you might use lambdas in this case, but just coz you can doesn&#039;t mean you should ;)

Thanks again :) Cheers!
OJ</description>
		<content:encoded><![CDATA[<p>Good question John <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Time for me to show my hand eh? Let me just go dig one up.</p>
<p>To be honest, I think it would vary depending on what was going on. But on the surface I would do exactly what you described in your last comment, though I might not go as far as having a registration mechanism. A simple switch based on type might be all that&#8217;s needed.</p>
<p>The crux of my &#8220;gripe&#8221; (for want of a better word) is that I find the manner in which the code has to be invoked rather unintuitive. If you wrapped up your current mechanism in a factory function I&#8217;d be a lot more comfortable with it. You&#8217;d have a simple function call through your code instead of foo[bar]();</p>
<p>Having said all that, your post is an interesting snippet of how you might use lambdas in this case, but just coz you can doesn&#8217;t mean you should <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Thanks again <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Cheers!<br />
OJ</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9531</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sun, 08 Mar 2009 11:40:51 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9531</guid>
		<description>@OJ
If you needed to do what is being done here how would you go about rewriting it?

Personally if improving readability is the aim (which of course is a key factor) I would create an actual factory which had an interface which I could add registrations to and then have a method by which I could retrieve registrations based on a key value. Under neither, the structure could do anything (i.e. use a dictionary, switch statement, or something else like an IoC).

But in if this pattern was going to be common in my code I probably would use an IoC.</description>
		<content:encoded><![CDATA[<p>@OJ<br />
If you needed to do what is being done here how would you go about rewriting it?</p>
<p>Personally if improving readability is the aim (which of course is a key factor) I would create an actual factory which had an interface which I could add registrations to and then have a method by which I could retrieve registrations based on a key value. Under neither, the structure could do anything (i.e. use a dictionary, switch statement, or something else like an IoC).</p>
<p>But in if this pattern was going to be common in my code I probably would use an IoC.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OJ</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9489</link>
		<dc:creator>OJ</dc:creator>
		<pubDate>Sat, 07 Mar 2009 11:08:32 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9489</guid>
		<description>Thanks for the responses guys. I don&#039;t exactly have a problem with the idea of a dictionary. The gratuitous lambdas which result in statements like this:

&lt;code&gt;panelFactory[myKey]()&lt;/code&gt;

.. is really where my issue lies. It&#039;s not immediately obvious what&#039;s going on there. I guess I personally don&#039;t see how this is actually any different to a switch (other than arguably slower?).

Each to their own, so long as I don&#039;t have to maintain it ;) Cheers lads!</description>
		<content:encoded><![CDATA[<p>Thanks for the responses guys. I don&#8217;t exactly have a problem with the idea of a dictionary. The gratuitous lambdas which result in statements like this:</p>
<p><code>panelFactory[myKey]()</code></p>
<p>.. is really where my issue lies. It&#8217;s not immediately obvious what&#8217;s going on there. I guess I personally don&#8217;t see how this is actually any different to a switch (other than arguably slower?).</p>
<p>Each to their own, so long as I don&#8217;t have to maintain it <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Cheers lads!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9462</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Fri, 06 Mar 2009 16:30:33 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9462</guid>
		<description>@Kevin

we&#039;re not using Prism or Caliburn (though i have been meaning to look into those).  We&#039;re currently using a custom solution which is based on my ASP.NET MVP approach with some extra&#039;s thrown in for databinding.</description>
		<content:encoded><![CDATA[<p>@Kevin</p>
<p>we&#8217;re not using Prism or Caliburn (though i have been meaning to look into those).  We&#8217;re currently using a custom solution which is based on my ASP.NET MVP approach with some extra&#8217;s thrown in for databinding.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Swiber</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9461</link>
		<dc:creator>Kevin Swiber</dc:creator>
		<pubDate>Fri, 06 Mar 2009 15:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9461</guid>
		<description>@OJ

I understand everyone has their own opinion, but for me, something like this helps create concise and readable code.  That&#039;s all.  &quot;Syntactic sugar&quot; gets thrown around quite a bit these days as if it&#039;s a bad thing.  I would say this is the &lt;em&gt;use&lt;/em&gt; of syntactic sugar, not an abuse of it.  I see this kind of code for operations that are class-internal and isolated.  It&#039;s quick to write, the intent is easy to understand, and it&#039;s useful.  Also, it&#039;s pretty easy to refactor if its use explodes.  No big deal.

@Davy

Silverlight, eh?  Using the MVVM pattern (aka WPF/SL-specific Presentation Model pattern) that&#039;s gaining popularity?  Prism?  Caliburn?  Whatever you&#039;re using, I wouldn&#039;t mind reading a post about it in the near future, if I might make a suggestion. ;)</description>
		<content:encoded><![CDATA[<p>@OJ</p>
<p>I understand everyone has their own opinion, but for me, something like this helps create concise and readable code.  That&#8217;s all.  &#8220;Syntactic sugar&#8221; gets thrown around quite a bit these days as if it&#8217;s a bad thing.  I would say this is the <em>use</em> of syntactic sugar, not an abuse of it.  I see this kind of code for operations that are class-internal and isolated.  It&#8217;s quick to write, the intent is easy to understand, and it&#8217;s useful.  Also, it&#8217;s pretty easy to refactor if its use explodes.  No big deal.</p>
<p>@Davy</p>
<p>Silverlight, eh?  Using the MVVM pattern (aka WPF/SL-specific Presentation Model pattern) that&#8217;s gaining popularity?  Prism?  Caliburn?  Whatever you&#8217;re using, I wouldn&#8217;t mind reading a post about it in the near future, if I might make a suggestion. <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9445</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Fri, 06 Mar 2009 10:00:15 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9445</guid>
		<description>@OJ

i guess it kinda depends on how you feel about switch statements... personally i try to avoid them as much as possible.  As for readability, i&#039;ll take the dictionary over a switch any day as well.</description>
		<content:encoded><![CDATA[<p>@OJ</p>
<p>i guess it kinda depends on how you feel about switch statements&#8230; personally i try to avoid them as much as possible.  As for readability, i&#8217;ll take the dictionary over a switch any day as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OJ</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9439</link>
		<dc:creator>OJ</dc:creator>
		<pubDate>Fri, 06 Mar 2009 05:53:41 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9439</guid>
		<description>To be honest I don&#039;t see this as anything other than abuse of syntactic sugar resulting in less readable code. How is this any better than a function with a switch statement?

The &quot;Coolness&quot; factor isn&#039;t justification for use of languages features. Where&#039;s the value-add?

Cheers :)
OJ</description>
		<content:encoded><![CDATA[<p>To be honest I don&#8217;t see this as anything other than abuse of syntactic sugar resulting in less readable code. How is this any better than a function with a switch statement?</p>
<p>The &#8220;Coolness&#8221; factor isn&#8217;t justification for use of languages features. Where&#8217;s the value-add?</p>
<p>Cheers <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
OJ</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9428</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 05 Mar 2009 23:10:19 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9428</guid>
		<description>@Bill

not in the silverlight code :)

we&#039;re actually using a lightweight custom IOC container implementation in our silverlight code, but i use it for &#039;real&#039; code, not the UI stuff

the server-side business layer uses Windsor all the way of course, i wouldn&#039;t have it any other way ;)</description>
		<content:encoded><![CDATA[<p>@Bill</p>
<p>not in the silverlight code <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>we&#8217;re actually using a lightweight custom IOC container implementation in our silverlight code, but i use it for &#8216;real&#8217; code, not the UI stuff</p>
<p>the server-side business layer uses Windsor all the way of course, i wouldn&#8217;t have it any other way <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pierce</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9427</link>
		<dc:creator>Bill Pierce</dc:creator>
		<pubDate>Thu, 05 Mar 2009 23:07:28 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9427</guid>
		<description>Not using Windsor in your project?</description>
		<content:encoded><![CDATA[<p>Not using Windsor in your project?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9421</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 05 Mar 2009 20:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9421</guid>
		<description>the class i used this in has to manage the currently visible panels... this means it has to create the initial panel instances, but it also occasionally has to replace a panel with a new instance.  Deciding which specific panel type to instantiate was one ugly switch statement, plus the instantiation statements were in 2 separate locations.

Now, the code that deals with replacing panels doesn&#039;t even need to know anything about which type of panel it needs to remove and create again.  It receives a value (previously the string key, but that&#039;s already been changed to an enum value) from an external component, and uses the dictionary-based factory to create a new instance and replace the previous instance (which is also stored in a dictionary based on the key/enum value) with the new one.  What used to be a switch statement has now become something like: SwitchPanel(key, panelFactory[key]()) which in turn can do something like:

var previousPanel = currentPanels[key];
previousPanel.Dispose();
currentPanels[key] = newPanel;

The only place where the actual types of the panels are used is in the dictionary-based factory, nowhere else</description>
		<content:encoded><![CDATA[<p>the class i used this in has to manage the currently visible panels&#8230; this means it has to create the initial panel instances, but it also occasionally has to replace a panel with a new instance.  Deciding which specific panel type to instantiate was one ugly switch statement, plus the instantiation statements were in 2 separate locations.</p>
<p>Now, the code that deals with replacing panels doesn&#8217;t even need to know anything about which type of panel it needs to remove and create again.  It receives a value (previously the string key, but that&#8217;s already been changed to an enum value) from an external component, and uses the dictionary-based factory to create a new instance and replace the previous instance (which is also stored in a dictionary based on the key/enum value) with the new one.  What used to be a switch statement has now become something like: SwitchPanel(key, panelFactory[key]()) which in turn can do something like:</p>
<p>var previousPanel = currentPanels[key];<br />
previousPanel.Dispose();<br />
currentPanels[key] = newPanel;</p>
<p>The only place where the actual types of the panels are used is in the dictionary-based factory, nowhere else</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stew</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9420</link>
		<dc:creator>Stew</dc:creator>
		<pubDate>Thu, 05 Mar 2009 20:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9420</guid>
		<description>@Davy,

I&#039;m wondering if you find some advantage in using this method in the two situations where you replaced the direct constructor calls?  Obviously, the need for IPanel is controlled by the class to which you are passing the concrete instance.

It seems to me that you would have some clear advantages by calling the constructor directly, such as the ability to discover usages of the class and compiler errors in any places where you may be using properties/methods specific to the concrete implementation.

Are you realizing some benefits that offset these concessions?</description>
		<content:encoded><![CDATA[<p>@Davy,</p>
<p>I&#8217;m wondering if you find some advantage in using this method in the two situations where you replaced the direct constructor calls?  Obviously, the need for IPanel is controlled by the class to which you are passing the concrete instance.</p>
<p>It seems to me that you would have some clear advantages by calling the constructor directly, such as the ability to discover usages of the class and compiler errors in any places where you may be using properties/methods specific to the concrete implementation.</p>
<p>Are you realizing some benefits that offset these concessions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9419</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 05 Mar 2009 19:22:08 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9419</guid>
		<description>@Stew,

that was exactly what i was trying to get away from in this class... these panels were instantiated whenever they were needed (which was in 2 situations) and i just didn&#039;t like it.  Also, the code that uses these panels only needs to have an IPanel instance, it doesn&#039;t really care about what specific panel it is.</description>
		<content:encoded><![CDATA[<p>@Stew,</p>
<p>that was exactly what i was trying to get away from in this class&#8230; these panels were instantiated whenever they were needed (which was in 2 situations) and i just didn&#8217;t like it.  Also, the code that uses these panels only needs to have an IPanel instance, it doesn&#8217;t really care about what specific panel it is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stew</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9406</link>
		<dc:creator>Stew</dc:creator>
		<pubDate>Thu, 05 Mar 2009 16:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9406</guid>
		<description>If you know enough about what type of object you need to be able to specify a &quot;key&quot; to the factory, don&#039;t you know enough to just call the constructor of the class?</description>
		<content:encoded><![CDATA[<p>If you know enough about what type of object you need to be able to specify a &#8220;key&#8221; to the factory, don&#8217;t you know enough to just call the constructor of the class?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjan`s World &#187; LINKBLOG for March 4, 2009</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9361</link>
		<dc:creator>Arjan`s World &#187; LINKBLOG for March 4, 2009</dc:creator>
		<pubDate>Wed, 04 Mar 2009 20:50:13 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9361</guid>
		<description>[...] Different Kind Of Factory? - Davy Brion [...]</description>
		<content:encoded><![CDATA[<p>[...] Different Kind Of Factory? &#8211; Davy Brion [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9358</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Wed, 04 Mar 2009 19:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9358</guid>
		<description>@Peter,

that comment just cost us our &#039;coolness&#039;-factor</description>
		<content:encoded><![CDATA[<p>@Peter,</p>
<p>that comment just cost us our &#8216;coolness&#8217;-factor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9357</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Wed, 04 Mar 2009 19:36:21 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9357</guid>
		<description>You bake the cake, I put the little cherry on top! ;-)</description>
		<content:encoded><![CDATA[<p>You bake the cake, I put the little cherry on top! <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9355</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Wed, 04 Mar 2009 19:32:34 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9355</guid>
		<description>yes, one of my coworkers (hi peter!) asked me why i didn&#039;t use an enum, so i eventually caved and started using an enum as the key

to be honest, it was mostly out of laziness why i didn&#039;t use an enum in the first place</description>
		<content:encoded><![CDATA[<p>yes, one of my coworkers (hi peter!) asked me why i didn&#8217;t use an enum, so i eventually caved and started using an enum as the key</p>
<p>to be honest, it was mostly out of laziness why i didn&#8217;t use an enum in the first place</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Swiber</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9354</link>
		<dc:creator>Kevin Swiber</dc:creator>
		<pubDate>Wed, 04 Mar 2009 19:27:33 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9354</guid>
		<description>I recently used similar code.  Very cool.  This works great when you only need to create objects within a single class.  If changes are made and at least one outside class suddenly needs to access that Dictionary object, it gets to be a small pain when using &quot;magic strings.&quot;  It feels safer using an enum as the key or refactoring to a typical factory class.  (Small point, but obvious.)  Also, if you have a ton of potential keys, an internally accessible enum is a better way to go (IMHO).  Intellisense = godsend.</description>
		<content:encoded><![CDATA[<p>I recently used similar code.  Very cool.  This works great when you only need to create objects within a single class.  If changes are made and at least one outside class suddenly needs to access that Dictionary object, it gets to be a small pain when using &#8220;magic strings.&#8221;  It feels safer using an enum as the key or refactoring to a typical factory class.  (Small point, but obvious.)  Also, if you have a ton of potential keys, an internally accessible enum is a better way to go (IMHO).  Intellisense = godsend.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Morris</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9350</link>
		<dc:creator>Peter Morris</dc:creator>
		<pubDate>Wed, 04 Mar 2009 17:48:34 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9350</guid>
		<description>Very nice :-)</description>
		<content:encoded><![CDATA[<p>Very nice <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/03/different-kind-of-factory/comment-page-1/#comment-9340</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Wed, 04 Mar 2009 12:28:18 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1041#comment-9340</guid>
		<description>The Dictionary returns the appropriate lambda (well, the Func actually) which is associated with the given key... only when you execute the return value of the dictionary is the lambda actually executed.

So yes, it only instantiates the objects when you retrieve the correct func and execute it... you could also use it like this:
var myCreationFunction = panelFactory[myKey];
myCreationFunction(); // this actually instantiates the panel</description>
		<content:encoded><![CDATA[<p>The Dictionary returns the appropriate lambda (well, the Func actually) which is associated with the given key&#8230; only when you execute the return value of the dictionary is the lambda actually executed.</p>
<p>So yes, it only instantiates the objects when you retrieve the correct func and execute it&#8230; you could also use it like this:<br />
var myCreationFunction = panelFactory[myKey];<br />
myCreationFunction(); // this actually instantiates the panel</p>
]]></content:encoded>
	</item>
</channel>
</rss>
