Why is the C ++ / CLI compiler easy to mix with characters?

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 example, recognizes that only IEnumerable<T>it has from in these namespaces System::Collections::Generic. Why can't the C ++ / CLI compiler do the same? Otherwise, I type in his full name or, at least Generic::IEnumerable<int>, he will not recognize it and will cause error C2872: ambiguous character.

Did I miss something?

+5
source share
1 answer

Given your namespaces, IEnumerable is ambiguous

MS defines IEnumerable in both System :: Collections and System :: Collections :: Generic , from which you want your code to be used?

+6

All Articles