An object reference is required.
Solved
sime
-
lepirate -
lepirate -
Hello,
I have these two lines of code:
int[] tab = new int[6];
tab = function(arg1, arg2);
Knowing that the function returns an integer array of size 6, I get the following error:
An object reference is required for the non-static property, method, or field 'function(arg1, arg2)'
Thank you for your help.
I have these two lines of code:
int[] tab = new int[6];
tab = function(arg1, arg2);
Knowing that the function returns an integer array of size 6, I get the following error:
An object reference is required for the non-static property, method, or field 'function(arg1, arg2)'
Thank you for your help.
4 answers
-
Hello,
You have probably solved your problem by now, but I'm posting the solution for those who will search later (like me)
This topic being the first result of a Google search on this error, I think it's useful to point that out.
You just need to declare your FUNCTION as STATIC ;)
-> public static int[] Function(int arg1, int arg2)
{...}
Best regards
--
The spoon does not exist!