Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length



Pages: [1]
  Print  
Author Topic: Working with Queues and threads.  (Read 34 times)
cordova
Newbie
*
Posts: 2


View Profile
« on: July 29, 2010, 03:19:31 PM »

Hi all,

I have a Cobra board and I'm trying to play with a Producer/Consumer queue in order to pass info (strings) from a producer thread to a consumer thread.

With the following code I just tried to create a Queue (without even creating the threads and codes) but recevied an error "Error   2   The non-generic type 'System.Collections.Queue' cannot be used with type arguments".


using System;
using System.Threading;
using System.Collections;
using Microsoft.SPOT;
using GHIElectronics.NETMF.FEZ;


namespace Queue_Test
{
    public class Program
    {
        public static void Main()
        {
            Queue<string> tasks = new Queue<string>();
        }

    }
}

Could you help me with queues creation ?

Best regards,

Alessandro

Logged
SupportAdmin
Administrator
Hero Member
*****
Posts: 5394



View Profile WWW
« Reply #1 on: July 29, 2010, 04:00:37 PM »

Quote
I have a Cobra board...

When why not posting here:
http://www.tinyclr.com/forum
Logged
quategra
Newbie
*
Posts: 34


View Profile
« Reply #2 on: July 30, 2010, 03:11:28 AM »

http://informatix.miloush.net/microframework/Articles/CisFeatures.aspx

look down there for "generics"




Code:
Queue queue = new Queue();

queue.Add("abc");
queue.Add("def");

for (int i = 0; i < queue.Count; i++)
{
Debug.Print(queue[i].ToString());
// or Debug.Print(queue[i] as String);
// or Debug.Print((String)queue[i]);
}
« Last Edit: July 30, 2010, 03:48:47 AM by quategra » Logged
Pages: [1]
  Print  
 
Jump to: