Indexers, MC++ and C#
-
Hi! I'm writing a cross-platform app using the .NET framework. The bulk of my program is in C# but for performance reasons, I'm had to implement a bit in Managed C++. My Managed C++ .dll includes a class that implements the IList interface: ... __property virtual bool get_IsReadOnly(); __property virtual Object* get_Item(int index); __property virtual void set_Item(int index, Object* value); virtual int Add(Object* value); etc. So, the get_Item/set_Item properties above appear as the Item property in VB.NET and MC++. In C#, it should appear as an indexer (object this[int index]). However, what I get is two methods called get_Item and set_Item. What's wrong?
-
Hi! I'm writing a cross-platform app using the .NET framework. The bulk of my program is in C# but for performance reasons, I'm had to implement a bit in Managed C++. My Managed C++ .dll includes a class that implements the IList interface: ... __property virtual bool get_IsReadOnly(); __property virtual Object* get_Item(int index); __property virtual void set_Item(int index, Object* value); virtual int Add(Object* value); etc. So, the get_Item/set_Item properties above appear as the Item property in VB.NET and MC++. In C#, it should appear as an indexer (object this[int index]). However, what I get is two methods called get_Item and set_Item. What's wrong?
This problem has been reported a few days ago in this same forum by someone else. Apparently MC++ collections are not accessible through C# indexers. I haven't tried it out yet. Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
-
This problem has been reported a few days ago in this same forum by someone else. Apparently MC++ collections are not accessible through C# indexers. I haven't tried it out yet. Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
Its not just MC++ collections that can't be accessible through C# indexers; its that MC++ indexers don't come up in C# as indexers. I can't figure out why that is; because I haven't looked into it much; maybe I'll revisit that issue now :) James
-
Its not just MC++ collections that can't be accessible through C# indexers; its that MC++ indexers don't come up in C# as indexers. I can't figure out why that is; because I haven't looked into it much; maybe I'll revisit that issue now :) James
James T. Johnson wrote: Its not just MC++ collections that can't be accessible through C# indexers; its that MC++ indexers don't come up in C# as indexers. I can't figure out why that is; because I haven't looked into it much; maybe I'll revisit that issue now Puzzling!!! Nish :suss:
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)