Implementing IEnumerable<T> in C++/CLI
问题 I'm having problems implementing IEnumerable<T> in my custom collection class in C++/CLI. Here is the relevant part of the code: using namespace System::Collections::Generic; ref class MyCollection : IEnumerable<MyClass^> { public: MyCollection() { } virtual IEnumerator<MyClass^>^ GetEnumerator() { return nullptr; } }; When compiled, this results in the following errors: error C2392: 'System::Collections::Generic::IEnumerator ^MyCollection::GetEnumerator(void)': covariant returns types are