作者ChenRobert (罗伯陈)
看板C_Sharp
标题[问题] 请问,如何用struct 写阵列?
时间Sun Sep 6 22:36:32 2020
如题:
public struct KEY_REGION
{
public Keys Min;
public Keys Max;
public KEY_REGION(Keys Min, Keys Max)
{
this.Min = Min;
this.Max = Max;
}
};
这是我宣告的struct
KEY_REGION[] KeyRegion = new KEY_REGION[2]
{ { Keys.NumPad0, Keys.NumPad9 } , { Keys.D0, Keys.D9 }};
我想要宣告个阵列,去存取初始值,可是会build error,
我不知道C#怎麽用struct去存阵列?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.34.193.134 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1599402994.A.ED8.html
1F:推 TPNEW: {{new KEY_REGION( Keys.NumPad0, Keys.NumPad9)}} 09/07 08:36