mercredi 2 décembre 2015

(C#) A field initializer cannot reference the non-static field, method, or property [duplicate]

This question already has an answer here:

Everytime i try to make a random int, it displays "A field initializer cannot reference the non-static field, method, or property" error. Any help? Code:

public class randapRefresh
{
   Random randap = new Random();
   int number1 = randap.Next(3, 90);
}

EDIT: Please dont mark it as duplicate. I know there are many questions about it but i didnt find anything to fix this.




Aucun commentaire:

Enregistrer un commentaire