Софтуерно Инженерство
Loading...
+ Нов въпрос
brandkikasd avatar brandkikasd 0 Точки

Compiler error: HashDictionary.cs, Chapter 18 Introduction to programming with c#

Hello

Please I need help compiling this code HashDictionary.cs in Chapter 18 of C# Programming. I keep getting compiler error in the last part of the code related to 

IEnumerator IEnumerable.GetEnumerator()

    {

        return ((IEnumerable<KeyValuePair<K, V>>)this).

            GetEnumerator();

    }

I am just trying to compile the code as it is in the textbook. 

Error information:

Chapter18.cs(761,5): error CS0305: Using the generic type
        'System.Collections.Generic.IEnumerator<T>' requires 1 type arguments
c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll: (Location of symbol
        related to previous error)

The full code is as follows

http://pastebin.com/nRE8s6zw

 

ModEdit: Please dont post long parts of code directly to the forum.

0
Структури от данни и алгоритми 17/09/2015 23:26:29
Filkolev avatar Filkolev 4428 Точки
Best Answer

Put the following using directive in your code: using System.Collections;

0
brandkikasd avatar brandkikasd 0 Точки

Thanks. I had using System.Collections.Generic intially.

I thought that namespace was sufficient for the code. The error is cleared. Thanks once again

0