locked
Newbie question. Help needed. RRS feed

  • Question

  • Hello,

    I'm trying to learn MRDS and I can't figure out this error. Please explain in detail

     

            private IEnumerable<ITask> IteratorHandler()
            {
                Port<int> p1 = new Port<int>();
                Port<int> p2 = new Port<int>();

                p1.Post(0);
                bool done = false;

                while (!done)
                {
                    yield return Arbiter.Receive(false, p1,
                        delegate(int i)
                        {
                            Console.WriteLine("p1 : {0} : {1}", Thread.CurrentThread.ManagedThreadId, i);
                            p2.Post(i + 1);
                        }
                    );

                    yield return Arbiter.Receive(false, p2,
                        delegate(int i)
                        {
                            Console.WriteLine("p2 : {0} : {1}", Thread.CurrentThread.ManagedThreadId, i);
                            if (i == 10)
                                done = true;
                            else
                                p2.Post(i + 1);
                        }
                    );
                }

                yield break;
            }

     

    then I added this code in below start()

     

     Arbiter.Activate(dq, Arbiter.FromIteratorHandler(IteratorHandler));

     

    But it's giving me error "Error    1    'System.Collections.Generic.IEnumerable<Microsoft.Ccr.Core.ITask> DSSService1.DSSService1Service.IteratorHandler()' has the wrong return type    D:\My Documents\Visual Studio 2008\Projects\DSS Service1\DSS Service1\DSSService1.cs    59    62    DSS Service1".

     

    Shivam

    Thursday, July 8, 2010 2:34 AM

Answers

All replies