<?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: A Type-safe BackgroundWorker Wrapper</title>
	<atom:link href="http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/feed/" rel="self" type="application/rss+xml" />
	<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 13 Jan 2010 16:31:08 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: stefan</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-14340</link>
		<dc:creator>stefan</dc:creator>
		<pubDate>Wed, 13 Jan 2010 16:31:08 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-14340</guid>
		<description>hello,

can you post the source code for this example?

Thank you</description>
		<content:encoded><![CDATA[<p>hello,</p>
<p>can you post the source code for this example?</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Farkas</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-11860</link>
		<dc:creator>Ivan Farkas</dc:creator>
		<pubDate>Wed, 30 Sep 2009 07:20:33 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-11860</guid>
		<description>I liked your cless so much I extended it.
Thx for the inspiration. Cheers, Ivan


using System;
using System.Linq;
using System.Linq.Expressions;
using System.ComponentModel;
using System.Threading;
using System.Collections.Generic;
using System.Text;

namespace DB
{
    public class DoWorkArg
    {
        public T Arg { get; private set; }
        public Action ReportProgress;
        public Action CancelAsync;

        public DoWorkArg(T Arg, Action reportProgress, Action cancelAsync)
        {
            this.Arg = Arg;
            this.ReportProgress = reportProgress;
            this.CancelAsync = cancelAsync;
        }
    }

    public class WorkerResult
    {
        public T Result { get; private set; }
        public Exception Error { get; private set; }
        public bool Cancelled { get; private set; }

        public WorkerResult(T result, Exception error, bool cancelled)
        {
            this.Result = result;
            this.Error = error;
            this.Cancelled = cancelled;
        }
    }

    public class WorkerProgress
    {
        public int ProgressPercentage { get; private set; }
        public Tus UserState { get;  private set; }

        public WorkerProgress(int progressPercentage, Tus userState)
        {
            this.ProgressPercentage = progressPercentage;
            this.UserState = userState;
        }
    }

    public class QueueItem
    {
        public Tin Arg { get; private set; }
        public BackgroundWorker BackgroundWorker { get; private set; }

        public QueueItem(BackgroundWorker backgroundWorker, Tin Arg)
        {
            this.BackgroundWorker = backgroundWorker;
            this.Arg = Arg;
        }
    }

    //public static class QueuedBackgroundWorker
    //{
    //    public static void QueueWorkItem(
    //        Queue&lt;QueueItem&gt; queue,
    //        Tin inputArg,
    //        Func&lt;DoWorkArg, Tout&gt; doWork,
    //        Action&lt;WorkerResult&gt; workerCompleted)
    //    {
    //        if (queue == null)
    //        {
    //            throw new ArgumentNullException(&quot;queue&quot;);
    //        }
    //        BackgroundWorker bw = new BackgroundWorker();

    //        bw.WorkerReportsProgress = true;
    //        bw.WorkerSupportsCancellation = true;
    //        bw.DoWork += (sender, args) =&gt;
    //        {
    //            if (doWork != null)
    //            {
    //                args.Result = doWork(new DoWorkArg((Tin)args.Argument));
    //            }
    //        };

    //        bw.RunWorkerCompleted += (sender, args) =&gt;
    //        {
    //            if (workerCompleted != null)
    //            {
    //                workerCompleted(new WorkerResult((Tout)args.Result, args.Error));
    //            }
    //            queue.Dequeue();
    //            if (queue.Count &gt; 0)
    //            {
    //                QueueItem nextItem = queue.Peek();
    //                nextItem.BackgroundWorker.RunWorkerAsync(nextItem.Arg);
    //            }
    //        };

    //        queue.Enqueue(new QueueItem(bw, inputArg));
    //        if (queue.Count == 1)
    //        {
    //            QueueItem nextItem = queue.Peek();
    //            nextItem.BackgroundWorker.RunWorkerAsync(nextItem.Arg);
    //        }
    //    }
    //}

    public static class BackgroundWorkerHelper
    {
        public static void DoWork(
            Tin inArg,
            Func&lt;DoWorkArg, Tout&gt; doWork,
            Action&lt;WorkerResult&gt; workerCompleted,
            Action&lt;WorkerProgress&gt; progressChanged)
        {
            BackgroundWorker bw = new BackgroundWorker();

            bw.WorkerReportsProgress = true;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork += (sender, args) =&gt;
            {
                if (doWork != null)
                {
                    Action reportProgress = new Action(bw.ReportProgress);
                    Action cancelAsync = new Action(bw.CancelAsync);
                    args.Result = doWork(new DoWorkArg((Tin)args.Argument, reportProgress, cancelAsync));
                }
            };
            bw.RunWorkerCompleted += (sender, args) =&gt;
            {
                if (workerCompleted != null)
                {
                    workerCompleted(new WorkerResult((Tout)args.Result, args.Error, args.Cancelled));
                }
            };
            bw.ProgressChanged += (sender, args) =&gt;
            {
                if (progressChanged != null)
                {
                    progressChanged(new WorkerProgress(args.ProgressPercentage, (Tus)args.UserState));
                }
            };
            bw.RunWorkerAsync(inArg);
        }
    }
}</description>
		<content:encoded><![CDATA[<p>I liked your cless so much I extended it.<br />
Thx for the inspiration. Cheers, Ivan</p>
<p>using System;<br />
using System.Linq;<br />
using System.Linq.Expressions;<br />
using System.ComponentModel;<br />
using System.Threading;<br />
using System.Collections.Generic;<br />
using System.Text;</p>
<p>namespace DB<br />
{<br />
    public class DoWorkArg<br />
    {<br />
        public T Arg { get; private set; }<br />
        public Action ReportProgress;<br />
        public Action CancelAsync;</p>
<p>        public DoWorkArg(T Arg, Action reportProgress, Action cancelAsync)<br />
        {<br />
            this.Arg = Arg;<br />
            this.ReportProgress = reportProgress;<br />
            this.CancelAsync = cancelAsync;<br />
        }<br />
    }</p>
<p>    public class WorkerResult<br />
    {<br />
        public T Result { get; private set; }<br />
        public Exception Error { get; private set; }<br />
        public bool Cancelled { get; private set; }</p>
<p>        public WorkerResult(T result, Exception error, bool cancelled)<br />
        {<br />
            this.Result = result;<br />
            this.Error = error;<br />
            this.Cancelled = cancelled;<br />
        }<br />
    }</p>
<p>    public class WorkerProgress<br />
    {<br />
        public int ProgressPercentage { get; private set; }<br />
        public Tus UserState { get;  private set; }</p>
<p>        public WorkerProgress(int progressPercentage, Tus userState)<br />
        {<br />
            this.ProgressPercentage = progressPercentage;<br />
            this.UserState = userState;<br />
        }<br />
    }</p>
<p>    public class QueueItem<br />
    {<br />
        public Tin Arg { get; private set; }<br />
        public BackgroundWorker BackgroundWorker { get; private set; }</p>
<p>        public QueueItem(BackgroundWorker backgroundWorker, Tin Arg)<br />
        {<br />
            this.BackgroundWorker = backgroundWorker;<br />
            this.Arg = Arg;<br />
        }<br />
    }</p>
<p>    //public static class QueuedBackgroundWorker<br />
    //{<br />
    //    public static void QueueWorkItem(<br />
    //        Queue&lt;QueueItem&gt; queue,<br />
    //        Tin inputArg,<br />
    //        Func&lt;DoWorkArg, Tout&gt; doWork,<br />
    //        Action&lt;WorkerResult&gt; workerCompleted)<br />
    //    {<br />
    //        if (queue == null)<br />
    //        {<br />
    //            throw new ArgumentNullException(&#8221;queue&#8221;);<br />
    //        }<br />
    //        BackgroundWorker bw = new BackgroundWorker();</p>
<p>    //        bw.WorkerReportsProgress = true;<br />
    //        bw.WorkerSupportsCancellation = true;<br />
    //        bw.DoWork += (sender, args) =&gt;<br />
    //        {<br />
    //            if (doWork != null)<br />
    //            {<br />
    //                args.Result = doWork(new DoWorkArg((Tin)args.Argument));<br />
    //            }<br />
    //        };</p>
<p>    //        bw.RunWorkerCompleted += (sender, args) =&gt;<br />
    //        {<br />
    //            if (workerCompleted != null)<br />
    //            {<br />
    //                workerCompleted(new WorkerResult((Tout)args.Result, args.Error));<br />
    //            }<br />
    //            queue.Dequeue();<br />
    //            if (queue.Count &gt; 0)<br />
    //            {<br />
    //                QueueItem nextItem = queue.Peek();<br />
    //                nextItem.BackgroundWorker.RunWorkerAsync(nextItem.Arg);<br />
    //            }<br />
    //        };</p>
<p>    //        queue.Enqueue(new QueueItem(bw, inputArg));<br />
    //        if (queue.Count == 1)<br />
    //        {<br />
    //            QueueItem nextItem = queue.Peek();<br />
    //            nextItem.BackgroundWorker.RunWorkerAsync(nextItem.Arg);<br />
    //        }<br />
    //    }<br />
    //}</p>
<p>    public static class BackgroundWorkerHelper<br />
    {<br />
        public static void DoWork(<br />
            Tin inArg,<br />
            Func&lt;DoWorkArg, Tout&gt; doWork,<br />
            Action&lt;WorkerResult&gt; workerCompleted,<br />
            Action&lt;WorkerProgress&gt; progressChanged)<br />
        {<br />
            BackgroundWorker bw = new BackgroundWorker();</p>
<p>            bw.WorkerReportsProgress = true;<br />
            bw.WorkerSupportsCancellation = true;<br />
            bw.DoWork += (sender, args) =&gt;<br />
            {<br />
                if (doWork != null)<br />
                {<br />
                    Action reportProgress = new Action(bw.ReportProgress);<br />
                    Action cancelAsync = new Action(bw.CancelAsync);<br />
                    args.Result = doWork(new DoWorkArg((Tin)args.Argument, reportProgress, cancelAsync));<br />
                }<br />
            };<br />
            bw.RunWorkerCompleted += (sender, args) =&gt;<br />
            {<br />
                if (workerCompleted != null)<br />
                {<br />
                    workerCompleted(new WorkerResult((Tout)args.Result, args.Error, args.Cancelled));<br />
                }<br />
            };<br />
            bw.ProgressChanged += (sender, args) =&gt;<br />
            {<br />
                if (progressChanged != null)<br />
                {<br />
                    progressChanged(new WorkerProgress(args.ProgressPercentage, (Tus)args.UserState));<br />
                }<br />
            };<br />
            bw.RunWorkerAsync(inArg);<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikelo</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-11334</link>
		<dc:creator>Mikelo</dc:creator>
		<pubDate>Mon, 07 Sep 2009 13:59:04 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-11334</guid>
		<description>Cool component!, thanks for that. Have anybody implemented a version that supports cancel and progress changed?</description>
		<content:encoded><![CDATA[<p>Cool component!, thanks for that. Have anybody implemented a version that supports cancel and progress changed?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eeee</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-9780</link>
		<dc:creator>Eeee</dc:creator>
		<pubDate>Thu, 11 Jun 2009 23:55:09 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-9780</guid>
		<description>
    public static class BackgroundWorkerHelper {

        /// 
        /// Creates a BackgroundWorker and hooks up to its DoWork and RunWorkerCompleted events. 
        /// This does not support cancellation or reporting of progress.
        /// 
        /// 
        /// 
        /// input argument of type Tin
        /// generic delegate which takes one 
        /// input parameter, a DoWorkArgument object, and returns an object of type Tout.
        /// generic delegate which must have a method 
        /// specified that accepts one input object of type WorkerResult and does not return anything.
        public static void DoWork(
            Tin inputArgument,
            Func&lt;DoWorkArgument, Tout&gt; doWork,
            Action&lt;WorkerResult&gt; workerCompleted) {
            BackgroundWorker bw = new BackgroundWorker();
            bw.WorkerReportsProgress = false;
            bw.WorkerSupportsCancellation = false;
            bw.DoWork += (sender, args) =&gt; {
                if (doWork != null) {
                    args.Result = doWork(new DoWorkArgument((Tin)args.Argument));
                }
            };
            bw.RunWorkerCompleted += (sender, args) =&gt; {
                if (workerCompleted != null) {
                    workerCompleted(new WorkerResult((Tout)args.Result, args.Error));
                }
            };
            bw.RunWorkerAsync(inputArgument);
        }

        /// 
        /// Similar to the above, except, use if one has a long-running method that
        /// doesn’t take any input parameters, but needs to update the UI when it is done. 
        /// 
        /// 
        /// generic delegate which takes no 
        /// input parameter, but returns an object of type Tout.
        /// generic delegate which must have a method 
        /// specified that accepts one input object of type WorkerResult and does not return anything.
        public static void DoWork(
            Func doWork,
            Action&lt;WorkerResult&gt; workerCompleted) {
            BackgroundWorker bw = new BackgroundWorker();
            bw.WorkerReportsProgress = false;
            bw.WorkerSupportsCancellation = false;
            bw.DoWork += (sender, args) =&gt; {
                if (doWork != null) {
                    args.Result = doWork();
                }
            };
            bw.RunWorkerCompleted += (sender, args) =&gt; {
                if (workerCompleted != null) {
                    workerCompleted(new WorkerResult((Tout)args.Result, args.Error));
                }
            };
            bw.RunWorkerAsync();
        }

        public delegate void Func();

        /// 
        /// Similar to the above, except, use if one has a long-running method that
        /// doesn’t take any input parameters, does not return output, but may need
        /// to update the UI when it is done. 
        /// 
        /// generic delegate which takes no 
        /// input parameter, and returns no output.
        /// 
        public static void DoWork(
            Func doWork,
            Action workerCompleted) {
            BackgroundWorker bw = new BackgroundWorker();
            bw.WorkerReportsProgress = false;
            bw.WorkerSupportsCancellation = false;
            bw.DoWork += (sender, args) =&gt; {
                if (doWork != null) {
                    doWork();
                }
            };
            bw.RunWorkerCompleted += (sender, args) =&gt; {
                if (workerCompleted != null) {
                    workerCompleted(args.Error);
                }
            };
            bw.RunWorkerAsync();
        }
    }

    /// 
    /// input argument of type Tin that gets passed to the DoWork event handler
    /// on a different thread.
    /// 
    /// 
    public class DoWorkArgument {
        public T Argument { get; private set; }

        public DoWorkArgument(T argument) {
            this.Argument = argument;
        }
    }

    /// 
    /// return value of type Tout
    /// 
    /// 
    public class WorkerResult {
        public T Result { get; private set; }
        public Exception Error { get; private set; }

        public WorkerResult(T result, Exception error) {
            this.Result = result;
            this.Error = error;
        }
    }
}

</description>
		<content:encoded><![CDATA[<p>public static class BackgroundWorkerHelper {</p>
<p>        ///<br />
        /// Creates a BackgroundWorker and hooks up to its DoWork and RunWorkerCompleted events.<br />
        /// This does not support cancellation or reporting of progress.<br />
        ///<br />
        ///<br />
        ///<br />
        /// input argument of type Tin<br />
        /// generic delegate which takes one<br />
        /// input parameter, a DoWorkArgument object, and returns an object of type Tout.<br />
        /// generic delegate which must have a method<br />
        /// specified that accepts one input object of type WorkerResult and does not return anything.<br />
        public static void DoWork(<br />
            Tin inputArgument,<br />
            Func&lt;DoWorkArgument, Tout&gt; doWork,<br />
            Action&lt;WorkerResult&gt; workerCompleted) {<br />
            BackgroundWorker bw = new BackgroundWorker();<br />
            bw.WorkerReportsProgress = false;<br />
            bw.WorkerSupportsCancellation = false;<br />
            bw.DoWork += (sender, args) =&gt; {<br />
                if (doWork != null) {<br />
                    args.Result = doWork(new DoWorkArgument((Tin)args.Argument));<br />
                }<br />
            };<br />
            bw.RunWorkerCompleted += (sender, args) =&gt; {<br />
                if (workerCompleted != null) {<br />
                    workerCompleted(new WorkerResult((Tout)args.Result, args.Error));<br />
                }<br />
            };<br />
            bw.RunWorkerAsync(inputArgument);<br />
        }</p>
<p>        ///<br />
        /// Similar to the above, except, use if one has a long-running method that<br />
        /// doesn’t take any input parameters, but needs to update the UI when it is done.<br />
        ///<br />
        ///<br />
        /// generic delegate which takes no<br />
        /// input parameter, but returns an object of type Tout.<br />
        /// generic delegate which must have a method<br />
        /// specified that accepts one input object of type WorkerResult and does not return anything.<br />
        public static void DoWork(<br />
            Func doWork,<br />
            Action&lt;WorkerResult&gt; workerCompleted) {<br />
            BackgroundWorker bw = new BackgroundWorker();<br />
            bw.WorkerReportsProgress = false;<br />
            bw.WorkerSupportsCancellation = false;<br />
            bw.DoWork += (sender, args) =&gt; {<br />
                if (doWork != null) {<br />
                    args.Result = doWork();<br />
                }<br />
            };<br />
            bw.RunWorkerCompleted += (sender, args) =&gt; {<br />
                if (workerCompleted != null) {<br />
                    workerCompleted(new WorkerResult((Tout)args.Result, args.Error));<br />
                }<br />
            };<br />
            bw.RunWorkerAsync();<br />
        }</p>
<p>        public delegate void Func();</p>
<p>        ///<br />
        /// Similar to the above, except, use if one has a long-running method that<br />
        /// doesn’t take any input parameters, does not return output, but may need<br />
        /// to update the UI when it is done.<br />
        ///<br />
        /// generic delegate which takes no<br />
        /// input parameter, and returns no output.<br />
        ///<br />
        public static void DoWork(<br />
            Func doWork,<br />
            Action workerCompleted) {<br />
            BackgroundWorker bw = new BackgroundWorker();<br />
            bw.WorkerReportsProgress = false;<br />
            bw.WorkerSupportsCancellation = false;<br />
            bw.DoWork += (sender, args) =&gt; {<br />
                if (doWork != null) {<br />
                    doWork();<br />
                }<br />
            };<br />
            bw.RunWorkerCompleted += (sender, args) =&gt; {<br />
                if (workerCompleted != null) {<br />
                    workerCompleted(args.Error);<br />
                }<br />
            };<br />
            bw.RunWorkerAsync();<br />
        }<br />
    }</p>
<p>    ///<br />
    /// input argument of type Tin that gets passed to the DoWork event handler<br />
    /// on a different thread.<br />
    ///<br />
    ///<br />
    public class DoWorkArgument {<br />
        public T Argument { get; private set; }</p>
<p>        public DoWorkArgument(T argument) {<br />
            this.Argument = argument;<br />
        }<br />
    }</p>
<p>    ///<br />
    /// return value of type Tout<br />
    ///<br />
    ///<br />
    public class WorkerResult {<br />
        public T Result { get; private set; }<br />
        public Exception Error { get; private set; }</p>
<p>        public WorkerResult(T result, Exception error) {<br />
            this.Result = result;<br />
            this.Error = error;<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eeee</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-9779</link>
		<dc:creator>Eeee</dc:creator>
		<pubDate>Thu, 11 Jun 2009 21:52:22 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-9779</guid>
		<description>Thanks, Matt - this is really helpful.  Would you mind posting (or emailing) the CS file.  The code is being mangled by the web page.</description>
		<content:encoded><![CDATA[<p>Thanks, Matt &#8211; this is really helpful.  Would you mind posting (or emailing) the CS file.  The code is being mangled by the web page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-9629</link>
		<dc:creator>Karl</dc:creator>
		<pubDate>Thu, 28 May 2009 20:11:12 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-9629</guid>
		<description>Your web page is mangling the code.  To Bob and others: view the page source to see the correct code.</description>
		<content:encoded><![CDATA[<p>Your web page is mangling the code.  To Bob and others: view the page source to see the correct code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-5970</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Sat, 24 Jan 2009 01:49:37 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-5970</guid>
		<description>Do you mind making a BackgroundWorkerHelper.cs file I can&#039;t seem to get this to work. Too many squigley red lines so it won&#039;t compile.</description>
		<content:encoded><![CDATA[<p>Do you mind making a BackgroundWorkerHelper.cs file I can&#8217;t seem to get this to work. Too many squigley red lines so it won&#8217;t compile.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quantum Bit Designs &#187; Blog Archive &#187; DelegateMarshaler - Replace Control.InvokeRequired and Control.Invoke</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-90</link>
		<dc:creator>Quantum Bit Designs &#187; Blog Archive &#187; DelegateMarshaler - Replace Control.InvokeRequired and Control.Invoke</dc:creator>
		<pubDate>Wed, 25 Jun 2008 03:04:34 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-90</guid>
		<description>[...] Linkshttp://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/ http://weblogs.asp.net/justin_rogers/articles/126345.aspx [...]</description>
		<content:encoded><![CDATA[<p>[...] Linkshttp://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/ <a href="http://weblogs.asp.net/justin_rogers/articles/126345.aspx" rel="nofollow">http://weblogs.asp.net/justin_rogers/articles/126345.aspx</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: valerio.net &#187; Blog Archive &#187; Multithreading and Concurrency in .NET</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-56</link>
		<dc:creator>valerio.net &#187; Blog Archive &#187; Multithreading and Concurrency in .NET</dc:creator>
		<pubDate>Sat, 14 Jun 2008 19:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-56</guid>
		<description>[...] A common scenario usually encountered when creating responsive user interfaces (e.g. WinForms applications) is to let a long-running piece of code execute on a background thread and then update the user interface when it completes.&#160; The catch is that the user interface update at the end must be completed on the UI thread.&#160; Thankfully .NET Framework shipped with a BackgroundWorker created explicitly for this task which handles the marshalling between background thread and UI thread automatically.&#160;&#160; It even supports cancellation and can report progress back to the UI thread in addition to notifying the UI thread that it has completed.&#160; This is also discussed in the &quot;Threading in C#&quot; book mentioned above.&#160; In addition, only slight modifications to the BackgroundWorker are needed to use anonymous types as well. [...]</description>
		<content:encoded><![CDATA[<p>[...] A common scenario usually encountered when creating responsive user interfaces (e.g. WinForms applications) is to let a long-running piece of code execute on a background thread and then update the user interface when it completes.&#160; The catch is that the user interface update at the end must be completed on the UI thread.&#160; Thankfully .NET Framework shipped with a BackgroundWorker created explicitly for this task which handles the marshalling between background thread and UI thread automatically.&#160;&#160; It even supports cancellation and can report progress back to the UI thread in addition to notifying the UI thread that it has completed.&#160; This is also discussed in the &quot;Threading in C#&quot; book mentioned above.&#160; In addition, only slight modifications to the BackgroundWorker are needed to use anonymous types as well. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: valerio.net &#187; Blog Archive &#187; A Queued BackgroundWorker Using Anonymous Delegates</title>
		<link>http://thevalerios.net/matt/2008/05/a-type-safe-backgroundworker-wrapper/comment-page-1/#comment-20</link>
		<dc:creator>valerio.net &#187; Blog Archive &#187; A Queued BackgroundWorker Using Anonymous Delegates</dc:creator>
		<pubDate>Tue, 20 May 2008 01:49:25 +0000</pubDate>
		<guid isPermaLink="false">http://thevalerios.net/matt/?p=18#comment-20</guid>
		<description>[...] A Type-safe BackgroundWorker Wrapper  [...]</description>
		<content:encoded><![CDATA[<p>[...] A Type-safe BackgroundWorker Wrapper  [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
