Reputation: 105077
Here is my code:
using namespace System;
using namespace System::Collections;
using namespace System::Collections::Generic;
namespace Tests {
ref class MyCollection : public IEnumerable<int> <----HERE!
The C# compiler, for instance, will recognize that the only IEnumerable<T>
it has in those namespaces is from System::Collections::Generic
. Why can't the C++/CLI compiler do the same? Unlesss I type its full name or at least Generic::IEnumerable<int>
, it won't recognize it and will fire a C2872 error: ambiguous symbol.
Am I missing something here?
Upvotes: 5
Views: 1307
Reputation: 32681
Given your namespaces IEnumerable is ambiguous
MS define IEnumerable in both System::Collections and System::Collections::Generic which of the 2 do you want your code to use?
Upvotes: 6