This might not be a solution since it is not clear, what you want to accomplish, please provide an example of "If brandList contains a,b,c, then result should look like x,y,z"
But there are several obvious issues already, maybe this gives you a few hints how to proceed:
Your index
i
is exceeding the bounds of the brandList array in the last loop. Fix: use
<
instead of
<=
:
for (int i =0; i < brandList->Count; i++)
{
result = new String * __gc[2];
}
Another problem is that in every loop you discard the previous result:
for (int i =0; i < brandList->Count; i++)
{
result = new String * __gc[2];
result[0] = brandList[i];
result[1] = brandList[i];
}