Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specification 25 Unsafe code 25.3 Fixed and moveable variables
Paragraph 11 The address-of operator (§25.5.4) and the fixed statement (§25.6) divide variables into two categories: Fixed variables and moveable variables.
Paragraph 21 Fixed variables reside in storage locations that are unaffected by operation of the garbage collector.
Paragraph 31 (Examples of fixed variables include local variables, value parameters, and variables created by dereferencing pointers.) 2 On the other hand, moveable variables reside in storage locations that are subject to relocation or disposal by the garbage collector. 3 (Examples of moveable variables include fields in objects and elements of arrays.)
Paragraph 41 The & operator (§25.5.4) permits the address of a fixed variable to be obtained without restrictions. 2 However, because a moveable variable is subject to relocation or disposal by the garbage collector, the address of a moveable variable can only be obtained using a fixed statement (§25.6), and that address remains valid only for the duration of that fixed statement.
Paragraph 51 In precise terms, a fixed variable is one of the following:
Paragraph 61 All other variables are classified as moveable variables.
Paragraph 71 Note that a static field is classified as a moveable variable. 2 Also note that a ref or out parameter is classified as a moveable variable, even if the argument given for the parameter is a fixed variable. 3 Finally, note that a variable produced by dereferencing a pointer is always classified as a fixed variable.
|Jagger Software Ltd|
|Company # 4070126|
|VAT # 762 5213 42|