10
Answers

Help! Error SetValue - GLOBAL ARRAY, it works

Kelvin Loke

Kelvin Loke

17y
2.7k
1
Hi, I´m trying to create a Global Array, but my code have an error, every time I try to debug I get this error : "Global.SetValue(int, int)': not all code paths return a value "

This is my code:

public Global()

{

arreglo = new int[3000];

}

public static int [] Arreglo

{

get { return arreglo; }

set { arreglo = value; }

}

public static int SetValue(int pos, int value)

{

arreglo[pos] = value;

}

public static int GetValue(int pos)

{

return arreglo[pos];

}

}

Can anyone help me with my problem? Thank you very much.

Answers (10)