[問題] 請問,如何用struct 寫陣列?

作者: ChenRobert (羅伯陳)   2020-09-06 22:36:32
如題:
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去存陣列?
作者: TPNEW (Peisky)   2020-09-07 08:36:00
{{new KEY_REGION( Keys.NumPad0, Keys.NumPad9)}}

Links booklink

Contact Us: admin [ a t ] ucptt.com