int i = new int ();
int , i . .
// new .
Using System;
class newValue {
static void Main() {
int i = new int(); // i
Console.WriteLine(" i : " + i);
}
}
.
i :
, i . , new, i . , WriteLine (), .
, new , . . , new .
, new . , , . new - . , . . , C++ delete. C# , : " ".
" " C# , . " " . , , . .
" " . , , . , , " ".
C# , " ". , . , , . , , , , , . , , . #.
|
|
:
~ _ () {
//
}
_ . , , , "" (~). , .
, . , . , , .
, , , " ". , , , , , . ( C# C++, , .) , , . , , " ", , .
, . . - " " .
// .
Using System;
class Destruct { public int x;
public Destruct(int i) {
= i;
}
// .
-Destruct() -{
Console.WriteLine(" " + );
}
// . public void Generator(int i) {
Destruct = new Destruct (i);
}
}
class DestructDemo { static void Main() { int count;
Destruct ob = new Destruct(0);
/* .
- " ".
: " ", , . */
for(count=l; count < 100000; count++) ob.Generator(count);
Console.WriteLine("!");
}
}
. . . , . Generator (), Destruct. DestructDemo ob Destruct, 100 . . " ". , , .. - , . , .. , "!", , for.
|
|
: WriteLine () -Destruct () . , , .
, , . " ", II #. " " , . , " " " " , , .
this
^ this. , , .. , . this. , this , . this, , Rect, Area (), .
Using System;
class Rect {