3.C#中const和readonly的區別

const是一個靜態的常量,必須在建立時進行初始化且沒法改變 readonly不是靜態的,在建立時的初始化是可選的,而且能夠在構造函數中對其進行操做web class Program { readonly static int a; const int b = 3; static Program() { a =
相關文章
相關標籤/搜索