<?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: An Alternative to the C# Generic new() Constraint</title>
	<atom:link href="http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/?&amp;owa_from=feed&amp;owa_sid=</link>
	<description>Thinking about agile (small 'a') software development, patterns and practices for building Microsoft .NET applications.</description>
	<lastBuildDate>Wed, 10 Mar 2010 23:02:38 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/comment-page-1/#comment-750</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Mon, 25 May 2009 15:26:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/#comment-750</guid>
		<description>dreamxpert,

You could use this approach. I prefer the &lt;a href=&quot;http://en.wikipedia.org/wiki/Inversion_of_Control&quot; rel=&quot;nofollow&quot;&gt;inversion of control pattern&lt;/a&gt; where EnsureElementExists&lt;T&gt; knows nothing about how to create an instance of T and relies on the delegate.

I&#039;d also we wary of using GetConstructor() as now you&#039;re using reflection which is likely to be slower than calling a delegate.

Ade</description>
		<content:encoded><![CDATA[<p>dreamxpert,</p>
<p>You could use this approach. I prefer the <a href="http://en.wikipedia.org/wiki/Inversion_of_Control" rel="nofollow">inversion of control pattern</a> where EnsureElementExists<t> knows nothing about how to create an instance of T and relies on the delegate.</p>
<p>I&#8217;d also we wary of using GetConstructor() as now you&#8217;re using reflection which is likely to be slower than calling a delegate.</p>
<p>Ade</t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dreamxpert</title>
		<link>http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/comment-page-1/#comment-746</link>
		<dc:creator>dreamxpert</dc:creator>
		<pubDate>Sat, 23 May 2009 16:51:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/#comment-746</guid>
		<description>Why not use this?
(T)typeof(T).GetConstructor(</description>
		<content:encoded><![CDATA[<p>Why not use this?<br />
(T)typeof(T).GetConstructor(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: An Alternative to the C# Generic new() Constraint using Lambdas &#124; #2782 - Agile software development, patterns and practices for building Microsoft .NET applications.</title>
		<link>http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/comment-page-1/#comment-623</link>
		<dc:creator>An Alternative to the C# Generic new() Constraint using Lambdas &#124; #2782 - Agile software development, patterns and practices for building Microsoft .NET applications.</dc:creator>
		<pubDate>Fri, 13 Mar 2009 23:37:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/#comment-623</guid>
		<description>[...] long while back I wrote about An alternative to the C# generic new() constraint using anonymous delegates to provide a mechanism for constructing an object which did not support a [...]</description>
		<content:encoded><![CDATA[<div style="border-left: #bce1f4 5px solid; padding-left: 1em;">
<p>[...] long while back I wrote about An alternative to the C# generic new() constraint using anonymous delegates to provide a mechanism for constructing an object which did not support a [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: #2872 &#187; Blog Archive &#187; Windows Live Writer</title>
		<link>http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/comment-page-1/#comment-116</link>
		<dc:creator>#2872 &#187; Blog Archive &#187; Windows Live Writer</dc:creator>
		<pubDate>Wed, 14 Nov 2007 23:20:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/#comment-116</guid>
		<description>[...] the WordPress web UI for authoring posts with a lot of code in. You might have noticed that the last attempt at code formatting was somewhat different. I&#8217;ve switched to using Windows Live Writer with Steve Dunn&#8217;s [...]</description>
		<content:encoded><![CDATA[<div style="border-left: #bce1f4 5px solid; padding-left: 1em;">
<p>[...] the WordPress web UI for authoring posts with a lot of code in. You might have noticed that the last attempt at code formatting was somewhat different. I&#8217;ve switched to using Windows Live Writer with Steve Dunn&#8217;s [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ade</title>
		<link>http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/comment-page-1/#comment-115</link>
		<dc:creator>Ade</dc:creator>
		<pubDate>Tue, 13 Nov 2007 17:14:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/#comment-115</guid>
		<description>Nice catch Jason,

I&#039;ve updated the code to reduce the constraint on ConstructorDelegate and fixed the if statement.

Ade</description>
		<content:encoded><![CDATA[<p>Nice catch Jason,</p>
<p>I&#8217;ve updated the code to reduce the constraint on ConstructorDelegate and fixed the if statement.</p>
<p>Ade</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Bock</title>
		<link>http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/comment-page-1/#comment-113</link>
		<dc:creator>Jason Bock</dc:creator>
		<pubDate>Tue, 13 Nov 2007 16:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2007/11/an-alternative-to-the-c-generic-new-constraint/#comment-113</guid>
		<description>Nifty idea...the only thing I&#039;m wondering about is why you have a where constraint on ConstructorDelegate. It seems like that would overtly constraint your open-ended solution.

And just to be nitpicky...wouldn&#039;t you add the object you just created in your if block so you wouldn&#039;t keep creating it?

Again, good idea - I like this :)</description>
		<content:encoded><![CDATA[<p>Nifty idea&#8230;the only thing I&#8217;m wondering about is why you have a where constraint on ConstructorDelegate. It seems like that would overtly constraint your open-ended solution.</p>
<p>And just to be nitpicky&#8230;wouldn&#8217;t you add the object you just created in your if block so you wouldn&#8217;t keep creating it?</p>
<p>Again, good idea &#8211; I like this :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
