[英]array of UInt16, what's the suffix in C#?
我正在嘗試初始化內聯一個UInt16數組。 對於int,我可以執行以下操作:
int[] int_array = new[]{0,0,0,0};
同時使用UInt16在沒有強制轉換的情況下無效:
UInt16[] uint16_array= new[]{(UInt16)0,(UInt16)0};
那些演員陣容很煩人。 我想知道C#中是否有任何后綴來消除賦值的歧義(如浮點數為0.0f)。
我不認為有一個,但你為什么不這樣做呢
UInt16[] uint16_array= new UInt16[] { 0, 0, 0, 0 };
這是比科里更短的方式:
ushort[] uint16_array = { 0, 0, 0, 0 };
(要么)
UInt16[] uint16_array = { 0, 0, 0, 0 };
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.