爲什麼這不起作用? 它是在視覺studo 2015,窗形成應用C#將隨機轉換爲int visual studio 2015
namespace guessing
{
public partial class Form1 : Form
{
Random rnd = new Random();
int rndm = rnd.Next(1, 13);
有下RND一個錯誤,這表示:
「A字段初始不能引用非靜態字段,方法,或 property'Form1.rnd'「
也許你想寫一個方法中的這些行,就像'Main'也許? –