jozamm
jozamm

Reputation: 31

use generic Queue in Mono 3.28 under ubuntu

I am using Mono 3.2.8 under Ubuntu 13.10. (The same problem crops up even when I used Mono 2.10.8). I cannot create a Queue object. I have added the System.Collections.Generic in the using statements.

I have tried creating the Queue using the following code:

private Queue<string> Message

or:

private System.Collections.Generic.Queue<string> Message

I have noticed that in the tooltip the Queue object does not come up (List comes up). The compiler error is:

"Error CS0246: The type or namespace name `Queue' could not be found. Are you missing an assembly reference? (CS0246) (Linux-sim)"

Do I need to download any mode modules?

Any help would be appreciated

Upvotes: 3

Views: 561

Answers (2)

Andrew Rondeau
Andrew Rondeau

Reputation: 683

I encountered this same problem. I had to add a reference to "System."

Somehow MonoDevelop didn't include the default reference to "System" when I created my project.

Upvotes: 1

sehe
sehe

Reputation: 393134

The folllowing test program JustWorks on Ubuntu 13.10:

using System.Collections.Generic;

public class Program
{
    public static void Main(string[] args)
    {
        var queue = new Queue<int>();
        queue.Enqueue(1);
        queue.Enqueue(2);
        queue.Enqueue(3);
        queue.Enqueue(4);
        queue.Enqueue(5);
        foreach(int i in queue)
            System.Console.WriteLine(i);
    }
}

System details:

Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-5ubuntu2)
Linux basehews 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

dpkg --get-selections | grep mono is here http://paste.ubuntu.com/7090621/

I can only assume you used the wrong compiler/options. I used

gmcs test.cs

or

dmcs test.cs

Both work.

Upvotes: 0

Related Questions