I have a static array and I need to pass an arbitrary element of it to a non-static method.
How do I do that?
public class MyClass
{
public static int[] staticArray = { 3, 11, 43, 683, 2731 };
public void SomeMethod(int value)
{
//...stuff...
}
public static void staticMethod()
{
SomeMethod(staticArray[2]); //error here
}
}
When I try something like that I get the error An object reference is required for the non-static field, method, or property.
...stuff...with// ...stuff....43was in value as expected.