Hi
I'm designing a code where one can guess the Magic Number.
In my code I have this part here where I declared the randomNumber after the class Form1. (the green mark below).
Can somebody tell me what's the name of this part here? Is it static variable? And what about the randomNumber under the InitializeComponent();?
Thanks
public partial class Form1 : Form
{
[B]private static int randomNumber;
private const int rangeNumberMin = 1;
private const int rangeNumberMax = 10; [/B]
public Form1()
{
InitializeComponent();
randomNumber = GenerateNumber(rangeNumberMin, rangeNumberMax);
}
private int GenerateNumber(int min,int max)
{
Random random = new Random();
return random.Next(min, max);
}
regards
C# NewBie