Each type in .Net is either value-type or reference-type. This is the most fundamental concept in .Net Common Type System. Memory for a value-type variable is allocated inline or on the stack (unless of course the value-type variable is a member of a reference-type object), and the reference-type variables are allocated on a heap managed by garbage collector. Here is an example code:
class Circle {
public Circle(int rad) {
radius = rad;
}
public double Area() {
double pi = 3.142; // double is a primitive value-type.
return pi*radius*radius;
}
// More methods here
private int radius; // int is also a primitive value-type.
}
class Test {
struct AreaTestCase {
Circle circle;
public void Run() {
circle = new Circle(10);
Console.WriteLine("Circle Area: {0}", circle.Area());
}
}
static void Main() {
var test_case = new AreaTestCase();
test_case.Run();
}
}
Which one of followings is not true about above code?