Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 


C# General articles and tutorials

Read C# General articles

Sort by:

<< Start < Prev 1 Next > End >>
Page 1 of 1

C# General articles and tutorials

# articles: 1  


Understanding Object Lifetime

View(s): 12871

Understanding Object Lifetime

.NET objects are allocated in a memory called managed heap, where they will be automatically destroyed by the garbage collector.

Before going into details you have to know about the class, object, reference, stack and heap.

A class is nothing but a blueprint that describes how an instance of this type will look and feel in memory. Classes, of course, are defined within a code file (which in C# takes a *.cs extension).

Consider a simple Car class defined in a C# Console Application project named SimpleGC:

    //Car.cs
    public class Car
    {
        private int currSp;
        private string petName;
        public Car() { }
        public Car(string name, int speed)
        {
            petName = name;
            currSp = speed;
        }

        public override string ToString()
        {
            return string.Format("{0} is going {1} MPH",
            petName, currSp);
        }
    }

Once a class is defined, you can allocate any number of objects using the C# new keyword.

Understand, that the new keyword returns a reference to the

(Continued...) View Full Aritlce


  Last updated on Tuesday, 03 December 2013
  Author: Kishore Kumar
4/5 stars (14 vote(s))

<< Start < Prev 1 Next > End >>
Page 1 of 1
Register Login Ask Us Write to Us Help