FIX: You receive the "Does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'" error message when you try to build a Web Control Library project (836127)
The information in this article applies to:
- Microsoft Visual C# .NET (2002)
SYMPTOMSYou receive an error message when you try to build a Web Control Library project in Microsoft Visual C# .NET 2002. Specifically, if the project contains a Web server control that implements the IDictionary interface, you receive an error message after the Implement Interface command runs. The error message that you
receive may be similar to the following: WebControlLibrary1.WebCustomControl1'
does not implement interface member
'System.Collections.IEnumerable.GetEnumerator()'.
'WebControlLibrary1.WebCustomControl1.GetEnumerator()'
is either static, not public, or has the wrong return type. Note The placeholders in this error message are as follows:
- WebControlLibrary1 is a placeholder for the name of
your namespace.
- WebCustomControl1 is a
placeholder for the class name of your Web server control.
CAUSEIn Visual C# .NET 2002, the Implement Interface command does not implement all methods of an interface if any
other methods that have the same name and parameters exist in another interface
that a class implements. This behavior occurs although the methods may have
different return data types.
For example, the Implement Interface command implements the GetEnumerator method of the IDictionary
interface. However, the Implement Interface command does not implement the GetEnumerator method of the
IEnumerable interface, although the methods have different return data types.
Therefore, you experience the symptoms that are described in this
article.RESOLUTIONTo resolve this behavior, add the following code to your Web
server control class file after the code that the Implement Interface command generates: System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return null;
} STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
This
bug was corrected in Microsoft Visual C# .NET 2003.
REFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
Modification Type: | Minor | Last Reviewed: | 1/18/2006 |
---|
Keywords: | kbfix kbCodeGen kbInheritance kbControl kbCollections kbClassView KB836127 kbAudDeveloper |
---|
|