[MonoDevelop] [help a mono newbie

Michael Hutchinson m.j.hutchinson at gmail.com
Wed Nov 4 14:51:44 EST 2009


On Wed, Nov 4, 2009 at 1:47 PM, james goforth <jamgof08 at gmail.com> wrote:
> [Task:File=/home/james/Projects/asdf2/asdf2/Main.cs, Line=12, Column=25,
> Type=Error, Priority=Normal, Description=The type or namespace name
> `IEnurmerable`1' could not be found. Are you missing a using directive or an
> assembly reference?(CS0246)]
>
> Can anyone tell me how to add assembly reference to a mono solution?I am
> trying to use system.linq to write the following prog
> using System;
> using System.Linq;
>
>     namespace asdf2
> {
>
>     class MainClass
>     {
>         string[] names = {"Tom","Dick","Harry","Mrk","Sebastian"};
>         public static void Main(string[] args)
>         {
>             IEnurmerable<string> query =
>                 from n in names
>                 let vowelless = Regex.Replace(n,"[,a,e,i,o,u]","")
>                 where vowelless.Length > 2
>                 orderby vowelless
>                 select n + " - " + vowelless;
>             Console.WriteLine(vowelless);
>                     }
>     }
> }

Summary from other messages of the things you need to do:

1. Add "using System.Collections.Generic;" to the top of the file,
since that's the namespace IEnumerable<T> is in.
2. Make sure you have a reference to "System" using the "edit
references" dialog - right-click on the "references" folder in the
project tree.
3. Double-check that the target framework is 3.5
4. Add a reference to "System.Core" because this is needed for
System.Linq and the LINQ queries.
5. Fix the type name - it's "IEnumerable", not "IEnurmerable" :-)

Steps 3 & 4 shouldn't be necessary, because those are the defaults in
MD 2.1+, but it's worth checking just in case.

Note that you can also use "var query = from ..." instead of
specifying the type explicitly.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list