473,761 Members | 10,498 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to System::Collect ions::Generic:: IEnumerable<T> in managed C++

Hi,

i'm trying to (using managed C++) implment the IEnumerable<Tin terface on
my class..
but have a problem with the 2 GetEnumerator method required.... what i have
done is...

generic<typenam e T>
public ref class SetOfProxy : public
System::Collect ions::Generic:: IEnumerable<T>
{
virtual System::Collect ions::Generic:: IEnumerator<T^G etEnumerator() =
System::Collect ions::Generic:: IEnumerable<T>: :GetEnumerator;

System::Collect ions::IEnumerat or ^GetEnumerator( ) =
System::Collect ions::IEnumerab le::GetEnumerat or;
}

when i complere this... i get.... what i'm i doing wrong...

Error 1 error C2556: 'System::Collec tions::IEnumera tor
^ManagedProxy:: SetOfProxy<T>:: GetEnumerator(v oid)' : overloaded function
differs only by return type from
'System::Collec tions::Generic: :IEnumerator<T>
^ManagedProxy:: SetOfProxy<T>:: GetEnumerator(v oid)' c:\development
work\system modeler\ngen~2. 0_cr1132\ngen\m odel\proxy\mana gedproxy\SetOf. h 65

Jun 15 '07 #1
2 7361
>i'm trying to (using managed C++) implment the IEnumerable<Tin terface on
>my class..
but have a problem with the 2 GetEnumerator method required.... what i have
done is...
Have you tried renaming one of the methods?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jun 16 '07 #2
Hi mattias,

thx!. that did it!!

Regards,

fred
"Mattias Sjögren" <ma************ ********@mvps.o rgwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
i'm trying to (using managed C++) implment the IEnumerable<Tin terface
on
my class..
but have a problem with the 2 GetEnumerator method required.... what i
have
done is...

Have you tried renaming one of the methods?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jun 17 '07 #3

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

Similar topics

6
4377
by: Doug Dew | last post by:
This won't compile: using IEnumerable<T> = System.Collections.Generic.IEnumerable<T>; namespace MyNamespace { public class MyClass<T> : IEnumerable<T> { // Appropriate stuff here }
10
2752
by: jcc | last post by:
Hi guys, I'm a newbie to C#. My Visual Studio 2005 failed to compile the following code with error as 'HelloWorld.A' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'. 'HelloWorld.A.GetEnumerator()' is either static, not public, or has the wrong return type. class A : IEnumerable<string>
3
6422
by: Adam Clauss | last post by:
I am developing an abstract class which implements IEnumerable<T>. I need the actual implemented methods here to be abstract as well - they will be implemented by MY subclasses. However, I cannot seem to get the explicit interface method to accept being abstract. Take the following simple class: abstract class TestEnumerable : IEnumerable<string>
1
2501
by: nick_tucker | last post by:
Hi, Could someone tell me which of the following is correct if I want to make the MyCollection class below enumerable public class MyCollection:System.Collections.IEnumerable { private List<MyItem> m_MyItemsList System.Collections.IEnumerator
15
2733
by: Gustaf | last post by:
Using VS 2005. I got an 'IpForm' class and an 'IpFormCollection' class, containing IpForm objects. To iterate through IpFrom objects with foreach, the class is implemented as such: public class IpFormCollection : IEnumerable<IpForm> { ArrayList forms = new ArrayList(); public IEnumerator<IpFormGetEnumerator() {
9
7907
by: Paul | last post by:
Hi, I feel I'm going around circles on this one and would appreciate some other points of view. From a design / encapsulation point of view, what's the best practise for returning a private List<as a property. Consider the example below, the class "ListTest" contains a private "List<>" called "strings" - it also provides a public method to add to that list,
8
2537
by: Andrus | last post by:
Code below causes error in class definition line .....Isolator<T>' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'. 'Myapp.Isolator<T>.GetEnumerator()' cannot implement 'System.Collections.IEnumerable.GetEnumerator()' because it does not have the matching return type of 'System.Collections.IEnumerator'. I tried to change method signature to
2
2499
by: Tony Johansson | last post by:
Hello! Below I have a working program. I have one generic class called Farm<T> with this header definition public class Farm<T: IEnumerable<Twhere T : Animal Now to my question I changed the inheritance of the IEnumerable from the generic IEnumerable<T> to the generel IEnumerable and the program function just the same so no
5
1799
by: Anders Borum | last post by:
Hello I'm developing an API with a number of concrete collections that inherit from an abstract collection hierarchy. Each inheritance level provides an implementation of IEnumerable<T>, thus allowing the developer to take full advantage of the LINQ extensions without having to start with a cast operation to a concrete type that matches the collection. I was surprised that the C# compiler was unable to resolve the type of the range...
0
9521
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10107
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3863
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
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.