c++ cli - how to fix "error C2872: 'IDictionary' :ambiguous symbol[ VS2012 - C++/CLI] -


i need use idictionary in project. when add compiler not , report obvious error “error c2872: 'idictionary' : ambiguous symbol” . if create new sample project compiler never reports error

  below code snippet  temp.h #pragma once #using "system.dll"  using namespace::system; using namespace::system::collections; using namespace::system::collections::specialized;  public ref class mycollection : public nameobjectcollectionbase {  private: dictionaryentry^ _de;  // gets key-and-value pair (dictionaryentry) using index.  public: property dictionaryentry^ default[ int ] {       dictionaryentry^ get(int index) {      _de->key = this->basegetkey( index );       _de->value = this->baseget( index );       return( _de );     }   }    // adds elements idictionary new collection.    mycollection( idictionary^ d ) {     _de = gcnew dictionaryentry();    each ( dictionaryentry^ de in d ) {     this->baseadd( (string^) de->key, de->value );       }   }     // removes entry specified key collection.     void remove( string^ key ) {     this->baseremove( key );   }     // removes entry in specified index collection.     void remove( int index ) {   this->baseremoveat( index );    }    }; 

since application has more 1 idictionary interface in different namespaces you'll have qualify reference. example:

system::collections::idictionary^ d 

or whatever namespace of other idictionary type is.

alternatively remove using statements 1 of namespace's.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -