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 a key-and-value pair (DictionaryEntry) using an index. public: property DictionaryEntry^ default[ int ] { DictionaryEntry^ get(int index) { _de->Key = this->BaseGetKey( index ); _de->Value = this->BaseGet( index ); return( _de ); } } // Adds elements from an IDictionary into the new collection. MyCollection( IDictionary^ d ) { _de = gcnew DictionaryEntry(); for each ( DictionaryEntry^ de in d ) { this->BaseAdd( (String^) de->Key, de->Value ); } } // Removes an entry with the specified key from the collection. void Remove( String^ key ) { this->BaseRemove( key ); } // Removes an entry in the specified index from the collection. void Remove( int index ) { this->BaseRemoveAt( index ); } };
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)