I saved my variables into a string of data, and then tried to convert those string back into the variables like the following:
using System;
public class Program
{
static int pop;
static string[] log = new string[10];
public static void Main()
{
string abc = "5 6 10 345 23 45";
log = abc.Split(' ');
Conv(3,pop);
Console.WriteLine(pop); // expected result: pop == 345
}
static void Conv(int i, int load)
{
if (log[i] != null){ load = int.Parse(log[i]);}
}
}
Pop should be 345, but return 0 instead. There is no problem when using
pop = int.Parse.log[i]