Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mono: type or namespace name 'HashSet' could not be found

Tags:

c#

mono

Sorry if my question is totally silly but I have just installed the latest versions of Mono (2.10.1) and MonoDevelop on Mac OS X 10.5 and this small piece of code doesn't compile

using System;
using System.Collections.Generic;

namespace Tests
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            HashSet<int> set = new HashSet<int>();
            Console.WriteLine("set.Add(5)={0}", set.Add(5));
        }
    }
} 

I get the error mentioned in the title when I compile... The settings of my projects say that I use Mono / .NET 3.5...

What may I have forgotten?

like image 937
pierroz Avatar asked Jul 07 '11 21:07

pierroz


1 Answers

I just reproduced this on Monodevelop 2.4 (32bit linux with mono 2.6.7).

This is bug

https://bugzilla.novell.com/show_bug.cgi?id=666944

Fix

Edit references to include 'System.Core' (3.5) It now compiles OK!


It is not a problem anymore in Monodevelop 2.6 (tested with mono 2.10, 32 bit linux)

like image 52
sehe Avatar answered Sep 21 '22 01:09

sehe