<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx</link><description>People have been asking about creating arbitrary delegates out of scriptblocks. As Jeffrey has mentioned, this isn't directly supported in V1.0 of PowerShell. It is, however, possible to do it using dynamic methods and the CreateDelegate call. Here's</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#9923963</link><pubDate>Wed, 18 Nov 2009 00:05:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9923963</guid><dc:creator>Serge van den Oever</dc:creator><description>&lt;p&gt;This code breaks on PowerShell 2. Are arbitrary delegates supported by PowerShell 2.0 out of the box?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923963" width="1" height="1"&gt;</description></item><item><title>DynamicMethod revisited: Making Powershell handle arbitrary delegates | Developer Home</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#8534740</link><pubDate>Fri, 23 May 2008 01:23:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8534740</guid><dc:creator>DynamicMethod revisited: Making Powershell handle arbitrary delegates | Developer Home</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.wowgoldip.com/2008/05/22/dynamicmethod-revisited-making-powershell-handle-arbitrary-delegates/"&gt;http://www.wowgoldip.com/2008/05/22/dynamicmethod-revisited-making-powershell-handle-arbitrary-delegates/&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8534740" width="1" height="1"&gt;</description></item><item><title>xion.log &amp;raquo; Triki z PowerShellem #1</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#8507877</link><pubDate>Thu, 15 May 2008 15:41:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8507877</guid><dc:creator>xion.log &amp;raquo; Triki z PowerShellem #1</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://xion.org.pl/2008/05/15/triki-z-powershellem-1/"&gt;http://xion.org.pl/2008/05/15/triki-z-powershellem-1/&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8507877" width="1" height="1"&gt;</description></item><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#8396816</link><pubDate>Tue, 15 Apr 2008 10:01:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8396816</guid><dc:creator>Brian Peiris</dc:creator><description>&lt;p&gt;I'd like to see a solution to Colin's problem myself. I've been trying to solve it for a while now, but the IL is over my head.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8396816" width="1" height="1"&gt;</description></item><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#7821405</link><pubDate>Wed, 20 Feb 2008 21:02:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7821405</guid><dc:creator>Nikolaus Rollinger</dc:creator><description>&lt;p&gt;I've detected the same problem as already posted by Colin Bowern.&lt;/p&gt;
&lt;p&gt;Is this not important enough to give it your attention?&lt;/p&gt;
&lt;p&gt;Hey, Jeff and Bruce, give it the necessary &amp;nbsp;attention, please. Don't forget we are your customers!&lt;/p&gt;
&lt;p&gt;I hope this helps!&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7821405" width="1" height="1"&gt;</description></item><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#7005798</link><pubDate>Sun, 06 Jan 2008 16:17:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7005798</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;Cool script, but crashs PowerShell with the following:&lt;/p&gt;
&lt;p&gt;PS E:\&amp;gt; $d = &amp;amp;get-delegate System.Threading.WaitCallback `&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; {&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; echo $args[0]&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; }&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;&lt;/p&gt;
&lt;p&gt;PS E:\&amp;gt; [System.Threading.ThreadPool]::QueueUserWorkItem ($d, &amp;quot;test&amp;quot;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7005798" width="1" height="1"&gt;</description></item><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#6801742</link><pubDate>Wed, 19 Dec 2007 05:31:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6801742</guid><dc:creator>Yuhong Bao</dc:creator><description>&lt;p&gt;Can you use this to create a thread using PowerShell?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6801742" width="1" height="1"&gt;</description></item><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#6734610</link><pubDate>Tue, 11 Dec 2007 15:36:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6734610</guid><dc:creator>Colin Bowern</dc:creator><description>&lt;p&gt;I'm trying to create a Predicate using this method but the result isn't correct:&lt;/p&gt;
&lt;p&gt;$domains = New-Object &amp;quot;System.Collections.Generic.List``1[System.String]&amp;quot;;&lt;/p&gt;
&lt;p&gt;$domains.Add(&amp;quot;foo.com&amp;quot;);&lt;/p&gt;
&lt;p&gt;$uri = New-Object System.Uri(&amp;quot;&lt;a rel="nofollow" target="_new" href="http://bar.com&amp;quot;"&gt;http://bar.com&amp;quot;&lt;/a&gt;);&lt;/p&gt;
&lt;p&gt;$delegate = get-delegate &amp;quot;System.Predicate``1[System.String]&amp;quot; { Write-Host $uri.Host &amp;quot; : &amp;quot; $args &amp;quot; = &amp;quot; ([String]::Compare($uri.Host, $args[0], $true) -eq 0); return ([String]::Compare($uri.Host, $args[0], $true) -eq 0); };&lt;/p&gt;
&lt;p&gt;$domains.Exists($delegate);&lt;/p&gt;
&lt;p&gt;The call to Exists returns true even though bar.com isn't in the collection.&lt;/p&gt;
&lt;p&gt;Thoughts on how where I'm going wrong?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6734610" width="1" height="1"&gt;</description></item><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#3675568</link><pubDate>Tue, 03 Jul 2007 23:17:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3675568</guid><dc:creator>Pangos</dc:creator><description>&lt;p&gt;You updated the script on the page, but not in the attachment. &amp;nbsp;If you use this utility, be sure to use version on the Blog page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3675568" width="1" height="1"&gt;</description></item><item><title>re: Creating arbitrary delegates from scriptblocks in PowerShell...</title><link>http://blogs.msdn.com/b/powershell/archive/2006/07/25/creating-arbitrary-delegates-from-scriptblocks-in-powershell.aspx#2958728</link><pubDate>Tue, 29 May 2007 07:22:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2958728</guid><dc:creator>Omid</dc:creator><description>&lt;p&gt;Is it possible to pass a powershell function as a delegate parameter to a .NET method?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2958728" width="1" height="1"&gt;</description></item></channel></rss>