|
using namespace System;
using namespace System::Configuration;
#include "ListElement.h"
namespace testAppConfig
{
ref class ListsElementCollection : ConfigurationElementCollection
{
protected:
property virtual String^ ElementName
{
String^ get() override { return gcnew String("mysection"); }
}
property virtual ConfigurationPropertyCollection^ Properties
{
ConfigurationPropertyCollection ^get() override { return gcnew ConfigurationPropertyCollection(); }
}
virtual ConfigurationElement^ CreateNewElement() override
{
return gcnew ListElement();
}
virtual Object^ GetElementKey(ConfigurationElement^ element) override
{
if (element != nullptr)
return ((ListElement^)element)->Name;
else
return nullptr;
}
public:
property virtual ConfigurationElementCollectionType CollectionType
{
ConfigurationElementCollectionType get() override { return ConfigurationElementCollectionType::BasicMap; }
}
property ListElement^ default[int]
{
ListElement^ get(int index) { return (ListElement^)BaseGet(index); }
void set(int index, ListElement^ value)
{
if (BaseGet(index) != nullptr)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
property ListElement^ default[String^]
{
ListElement ^get(String^ name) new { return (ListElement^)BaseGet(name); }
}
void Add(ListElement^ item)
{
BaseAdd(item);
}
void Remove(ListElement^ item)
{
BaseRemove(item);
}
void RemoveAt(int index)
{
BaseRemoveAt(index);
}
void Clear()
{
BaseClear();
}
};
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I'm a french developper, specially interested in windows programming with my favourite language, C++.
Beginning Windows programs with Win32, API & MFC, I finally move on C++/CLI. Now, I'm a Visual C++ MVP since 2007
My web site (in french
nico-pyright.developpez.com) contains article and tutorial about Win32, MFC & C++/CLI.
I've also written a
C++/CLI FAQ (to be continued ...)