473,769 Members | 3,102 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 7363
>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
4378
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
2753
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
2506
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
7908
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
1800
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
9423
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10050
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
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
7413
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
5310
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
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
2815
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.