473,550 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

compile error problems

Hello!

I get the following compile error below in the complete program below.
Any suggestion

Error 1 Using the generic type 'System.Collect ions.Generic.IE numerator<T>'
requires '1' type arguments
C:\tony\Console Application15\C onsoleApplicati on15\Program.cs 80 9
ConsoleApplicat ion15

namespace ConsoleApplicat ion15
{
class Program
{
static void Main(string[] args)
{

}
}

public abstract class Animal
{
string name;
public Animal(string name)
{
this.name = name;
}

public string Name
{
get { return name; }
}

public abstract void MakeANoise();
}

public class Chicken : Animal
{
public Chicken(string name) : base(name)
{}

public override void MakeANoise()
{
Console.WriteLi ne("{0} says 'cluck!'", Name);
}
}

public class Cow : Animal
{
public Cow(string name) : base(name)
{ }

public override void MakeANoise()
{
Console.WriteLi ne("{0} says 'moo!'", Name);
}
}

public class SuperCow : Cow
{
public SuperCow(string name) : base(name)
{ }

public void Fly()
{
Console.WriteLi ne("{0} is flying!", Name);
}

public override void MakeANoise()
{
Console.WriteLi ne("{0} says 'here I come to save the day!'",
Name);
}
}
public class Farm<T: IEnumerable<T>
where T : Animal
{
private List<Tanimals = new List<T>();

public List<TAnimal
{
get { return animals; }
}

IEnumerator IEnumerable.Get Enumerator()
{
return animals.GetEnum erator();
}

public IEnumerator<TGe tEnumerator()
{
return animals.GetEnum erator();
}
public void MakeNoises()
{
foreach (T animal in animals)
{
animal.MakeANoi se();
}
}

public void FeedTheAnimals( )
{
foreach (T animal in animals)
{
animal.Feed();
}
}

public Farm<CowGetCows ()
{
Farm<CowcowFarm = new Farm<Cow>();
foreach (T animal in animals)
{
if (animal is Cow)
cowFarm.animals .Add(animal as Cow);
}

return cowFarm;
}
}
}

//Tony
Jun 27 '08 #1
1 1468
On Jun 18, 3:25*pm, "Tony" <johansson.ande rs...@telia.com wrote:
I get the following compile error below in the complete program below.
Any suggestion

Error 1 Using the generic type 'System.Collect ions.Generic.IE numerator<T>'
requires '1' type arguments
C:\tony\Console Application15\C onsoleApplicati on15\Program.cs 80 9
ConsoleApplicat ion15
It's hard to say for sure because you haven't included your using
directives, but I suspect the problem is that you're missing:
using System.Collecti ons;

That's required to let the compiler know about the nongeneric
IEnumerator type.

After that you'll need to add a Feed method to Animal.

Jon
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3308
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new rightType;
5
3798
by: Brice Prunier | last post by:
Here under 4 schemas i'm working with ( it may be long: sorry...) The context is the following : Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema: no TargetNamespace ) Person.xsd includes Common-Naming.xsd ( anonimous schemas ) Common-Naming.xsd includes common.xsd ( both are anonimous schemas ) Compilation of...
9
3740
by: serge | last post by:
I have a stored procedure that is over 1000 + lines of code. When i try to compile I get the following error: ABC.TEST123: 1285: SQL0104N An unexpected token "END" was found following " END IF; END IF; ". Expected tokens may include: "END". LINE NUMBER=1285. SQLSTATE=42601 I tried creating a new tablespace + buffer pool on...
2
23922
by: bradleyp | last post by:
Hi all, Hopefully somebody can help. In Access 2002-SP2, I receive an error from the VB Editor if I try to compile the following code (see below). The error is as follows: Compile Error: Method or data member not found The follow subroutine is highlighted (specifically .txtNR_Program1):
10
19695
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I have a struct that contains several different types of data. This struct is used throuout the program. Now, when I compile, I get 6 errors, all of...
2
3296
by: Gustavo | last post by:
After updating Windows 2000 I began to get a weird compile error message: Deleting intermediate files and output files for project 'pp - Win32 Debug'. --------------------Configuration: pp - Win32 Debug-------- ------------ Compiling... pp.cpp c:\program files\microsoft visual studio\vc98
6
1287
by: Kevin Atherton | last post by:
Hello. I work for a large web company, and we are in the process of converting our old .asp pages to .aspx with VB code-behind. The solution includes 8 projects, all of which are very interwoven. The problem is that when I first open the IDE and load my solution, if I try to build or build all, it gets partway through the compile and...
4
9377
by: Siegfried Heintze | last post by:
It appears that the automatic compilation feature of ASP.NET causes problems with a security package called Black Ice that my hosting service is using. I'm hoping that if I manually compile my web service, I can avoid the randomly named DLLs that ASP.NET creates when I hit my web service after FTPing new C# source code. So I used Visual...
1
5373
by: electrixnow | last post by:
Help!, I need to compile this code with static libs so it run on another XP machine that does'nt have MS Studio installed. When I compile now I get an ERROR: 1>------ Rebuild All started: Project: drawing_control, Configuration: Release Win32 ------ 1>Deleting intermediate and output files for project 'drawing_control', configuration...
15
4784
by: steve yee | last post by:
i want to detect if the compile is 32 bits or 64 bits in the source code itself. so different code are compiled respectively. how to do this?
0
7563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7490
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7765
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8001
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5129
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3533
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3519
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1980
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.