count: 99 count: 10
fixed
fixed, " '7. , , , . " ", , . fixed:
fixed (* = &_) {
//
}
, . . fixed , . fixed , . , fixed .
fixed.
// fixed.
Using System;
class Test {
Public int num;
public Test (int i) { num = i; }
}
class FixedCode {
// Main() , unsafe static void Main() {
Test = new Test(19);
fixed (int* p = &o.num) { // fixed
// .num
Console.WriteLine(" .num: " + *);
* = 10; // 10 count,
//
Console.WriteLine(" .num: " + *);
}
}
}
.
.num: 19 .num: 10
. fixed . . num, , .
, . - (->), - (.). ,
struct MyStruct { public int a; public int b;
public int Sum() { return a + b; }
}
.
MyStruct = new MyStruct();
MyStruct* p; //
p = &o;
p->a = 10; // -> p->b =20; // ->
Console.WriteLine(" " + p->Sum());
: ++, , + -. , , . , pi 2000, .. 2000.
|
|
pl++;
pi 2004, 2001! , pi int. int C# 4 , pi 4. : pi 4.
Pl;
, pl 1996, 2000!
: , , , .
. . , :
pi = pi + 9;,