1.值型別有三種:簡單值型別,結構體(關鍵字:struct),列舉(關鍵字:enum);
2.值型別的資料是在棧上申請記憶體來儲存的,它寄存的類是valuetype;
class program
static gamestate gamestate =gamestate.gamestart; //宣告乙個列舉變數並給它初始化賦值
static void main(string args)
",gamestate);
break;
case gamestate.ganmestop:
console.writeline("遊戲開始",(byte) gamestate);
break;
case gamestate.gameexit:
console.writeline("遊戲開始對應的值: 名稱", (byte)gamestate, gamestate);
break;
}
} }
// struct point 結構體
////1.資料長度固定
//2.資料存在棧(stack)上面//資料是存在堆上面的,資料所對應的位址存在棧上面的
//3.所有的值型別都繼承於valuetype
//byte 0-255 位元組,質變數
//sbyte-128~127 有符號的位元組
//short -32768~32767 短整型
//ushort 0~65535 無符號短整型
//int -2`31-1~-2`31 整型
//uint 0~2`32-1 無符號整型,正整型
//long -2`63-1~-2`63 長整型
//ulong 0~2`64-1 無符號長整型
//char unincode 16 位字元 字元
//float +-1.5e-45 單精度浮點
//double 雙精度浮點
//decimal 最大的表達方式
//boolean bool true/false 真假變數
這篇還有很多內容沒有學到,忘有經驗的前輩們給點建議。謝謝!
c sharp 菜鳥的學習歷程
新手駕到,第一天學習,忘走在前方的前輩們給予晚輩我多多的指教.謝謝!引用外部的命名空間 using system using system.collections.generic using system.linq using system.text using system.threading.t...
c sharp 菜鳥的學習歷程3
class program static void main string args int i b.indexof c indexof提取vincet裡 面相同字母的陣列分大小寫且只找乙個 m 在vincetc 第三位插入m console.write b.remove 6,1 除vincetc第...
C sharp 乙個菜鳥學習歷程
1.值型別的資料是在棧上申請記憶體來儲存的,它寄存的類是valuetype 2.值型別有三種 簡單值型別,結構體 關鍵字 struct 列舉 關鍵字 enum byte 0到255 sbyte 128到127 shotr 短整形 32768到32767 ushotr 無符號短整形0到65535 in...