Value Type (實質型別):
Value Type 變數,儲存的值為「實值」,像是整數、浮點數、布林、字元。
常見的型別有 :struct、int、char、dobule
在記憶體中:
以 Stack 方式儲存,儲存的是 Value Type 變數的實值
範例:
Reference Type (參考型別):
Reference Type 變數,儲存的值為「參考」,也就是記憶體的位址。
常見的型別有 :使用class 關鍵字定義的型別
在記憶體中:
以 Stack 方式儲存,儲存的是 Reference Type 的參考
以 Heap 方式儲存,儲存的是 new 關鍵字實體化的物件內容
而 Stack 的參考,其內容其實就是儲存 Heap 的記憶體位址

![[C#][筆記] Value Type (實值型別) vs. Reference Type (參考型別)](https://www.notion.so/image/https%3A%2F%2F64.media.tumblr.com%2F49b5b96b71e330b56f92e075f6d7997c%2F82dbc8f70fc01701-f2%2Fs540x810%2F53d442e7fd5277d125c9df7e2d01b56724b3351f.png?table=block&id=e31089fb-c58d-40cd-ba75-88f81fcfbbbe&t=e31089fb-c58d-40cd-ba75-88f81fcfbbbe)