I have an array that I want to be able to access in two separate methods and also in other files. To do this I have had to declare it as Static, can this be done another way? because I don't want to declare it as static
This is an example of part of my code.
ref struct StrCls
{
static cli::array<String ^, 2> ^ CombinedArr = gcnew cli::array<String ^, 2>(100,20);
void write_array()
{
StreamWriter^ MyStream = gcnew StreamWriter("c:\\log.txt");
for (int n=0;n<100;n++)
for (int m=0;m<20;m++)
MyStream->Write(CombinedArr[n,m]);
MyStream->Flush();
}
void merge_array(cli::array<String ^, 2> ^% PassedArr)
{
for(int n=0;n<10; n++)
for(int m=0;m<2; m++)
CombinedArr[n,m] = PassedArr[n,m];
}
};