參考類型 (C# 參考)Reference types (C# Reference)

C# 中有兩種類型:參考類型和實值類型。There are two kinds of types in C#: reference types and value types. 參考類型的變數會儲存期資料 (物件) 的參考,而實值類型的變數則會直接包含其資料。Variables of reference types store references to their data (objects), while variables of value types directly contain their data. 使用參考類型時,這兩種變數可以參考相同的物件,因此對其中一個變數進行的作業可能會影響另一個變數所參考的物件。With reference types, two variables can reference the same object; therefore, operations on one variable can affect the object referenced by the other variable. 使用實值型別時,每個變數都有自己的資料複本,因此對某一個變數進行的作業,不可能會影響其他變數 (但 in、ref 及 out 參數變數除外,請參閱 inrefout 參數修飾詞)。With value types, each variable has its own copy of the data, and it is not possible for operations on one variable to affect the other (except in the case of in, ref and out parameter variables; see in, ref and out parameter modifier).

下列關鍵字用來宣告參考類型:The following keywords are used to declare reference types:

C# 還提供下列內建參考類型:C# also provides the following built-in reference types:

另請參閱See also