I'm having a char array :
public static char[] boardposition = new char[9];
I want to reset the array , my written function for this is:
public static void Reset()
{
Array.Clear(boardposition,9, boardposition.Length);
}
When I call the Reset() I get an exception of type IndexOutOfRangeException.
I hope you guys can help me out.
You are passing 9 as starting index wich isn't a valid index for your array. Make the call like this Array.Clear(boardposition,0, boardposition.Length);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With