/ * In My Translation, Microsoft NGWS SDK's Documentation and MSDN Are Also Reference In Somewhere.
1.2 Automatic Memory Management (Automatic Memory Management) Manually Manually requires programmers to assign and release memory blocks themselves. This requires the programmer to have a clear mind and a very grasp of the entire running process (it!). And C # liberates programmers from this difficult task. In most cases, this automatic memory management increases the quality of the code and the productivity of the programmer. Also, the influence of the intent and implementation of the program (? 俺 can not believe in M $ ghost). However, it is estimated that it is better than Java's recycle. Because C # is awkward (tab). Ok, let's take a look at the example. * / using system; public class stack {private node first = null; public bool empty {get {return (first == null);}} public object pop () {if (first == null) throw new exception ("CAN 'T Pop from an Empty Stack. "); Else {Object Temp = first.value; first = first.next; return temp;}} public void push (Object O) {first = new node (o, first);} Class node {public node next; public node (Object value): this (value, null) {} public node (object value, node next) {next = next; value = value;}}} class test { Static void main () {stack s = new stack (); for (int i = 0; i <10; i) s.push (i); while (! s.empty) console.writeline (S.POP () }} / * The Stack class implements a series of Node instances. You can look at the Push method of the Stack class. An instance of Node is created in the PUSH method. That is, "first = new node (o, first);". Remember this "new". It is used to create class instances. There are too many related grammar, and you will tell the section later. Here is just the benefits of Automatic Memory Management (Automatic Memory Management)? ! "New" is responsible for the initialization instance. And release these examples in C / C to use another keyword "delete". But when do you use Delete, this is usually a very feminine, and the older will pass through the ditch. What's more! But there is no need in C #. There is no "delete" in the example. When the instance of Node is not required, the garbage collector automatically destroyed it, no need to worry. This is very like Java (probably copy).