A very weird incident happened some time back and i have written in detail about it here. It is about my perception about Reference types in general and analysing whether they function how it has been perceived by developers.
This is a code forwarded by a friend of mine which triggered the argument.
using System;
namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Class1 c =new Class1() ;
valhold v=new valhold() ;
c.method1(v);
Console.Write (v.i);
}
void method1(valhold v)
{
int i=0;
v.i=20;
valhold vh=new valhold();
v=vh;
Console.Write (v.i);
}
}
class valhold
{
public int i=10;
}
}
Try to predict the result ! It does seem like another one of those C type puzzles in books but hmm .. I dont know ! Read about my experience with this here if you are interested :)