Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# F中的对象数组或列表#_C#_.net_F#_Functional Programming - Fatal编程技术网

C# F中的对象数组或列表#

C# F中的对象数组或列表#,c#,.net,f#,functional-programming,C#,.net,F#,Functional Programming,我有一个从button()派生的自定义button类: 如何像下面的C代码那样,在F中创建Game15按钮数组 MyButton[] buttons = new MyButton[16]; int i = 0; for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++){ buttons[i] = new MyButton(); buttons[i].Size = new Size(50,

我有一个从button()派生的自定义button类:

如何像下面的C代码那样,在F中创建Game15按钮数组

MyButton[] buttons = new MyButton[16]; 

int i = 0;
for (int y = 0; y < 4; y++)
   for (int x = 0; x < 4; x++){     
      buttons[i] = new MyButton();
      buttons[i].Size = new Size(50, 50);
      buttons[i].Pozition = new Point(x, y);
      i++;
   }
MyButton[]按钮=新建MyButton[16];
int i=0;
对于(int y=0;y<4;y++)
对于(intx=0;x<4;x++){
按钮[i]=新的MyButton();
按钮[i]。尺寸=新尺寸(50,50);
按钮[i]。Pozition=新点(x,y);
i++;
}

如果需要数组,请使用
[|…|]

您对翻译的哪一部分有问题?@JohnPalmer我想我可以使用F#中的System.Collections.Generic,thanx
MyButton[] buttons = new MyButton[16]; 

int i = 0;
for (int y = 0; y < 4; y++)
   for (int x = 0; x < 4; x++){     
      buttons[i] = new MyButton();
      buttons[i].Size = new Size(50, 50);
      buttons[i].Pozition = new Point(x, y);
      i++;
   }
let buttons = [
    for y in {0..3} do
    for x in {0..3} do
    yield Game15Button(Point(x, y), Size = Size(50, 50))
]