It's my own solution. For the first I fill the struct
for (int i = 0 ; i < size ; i++ )
{
(datas+i)->value1 = i;
(datas+i)->value2 = i;
}
After, I create the Class
, which save the data from datas
public ref class Values
{
private:
int _value1;
int _value2;
public:
Values();
property int Value1
{
int get();
void set(int value);
}
property int Value2
{
int get();
void set(int value);
}
};
So, I can fill the List
with data from my struct
List<Values^>^ mValues = gcnew List<Values^>();
for (int i = 0 ; i < size ; i++ )
{
Values^ newValues = gcnew Values();
newValues->Value1 = (datas+i)->value1;
newValues->Value2 = (datas+i)->value2;
mValues->Add(newValues);
}
After all, I can remove one of item by the mValues->RemoveAt(1);
? clear the memory free(datas);
and recreate struct with new size
size = mValues->Count;
datas = (struct values *) malloc(size * sizeof(struct values) );
And fill it from List
for (int i = 0; i < size; i++)
{
Values^ curValue = mValues[i];
(datas+i)->value1 = curValue->Value1;
(datas+i)->value2 = curValue->Value1;
}
That's all, I hope it can help someone!