This is because parameters are passed by value, so in your test method, a copy of parent variable has been created, you are just setting the copy of variable to null. Though you still can manipulate the object because the copy variable is pointing to the object in the heap.
class Program
{
static void Main(string[] args)
{
Foo foo = new Foo();
SetNull(foo);
Console.WriteLine(foo.ID);// print 2
}
private static void SetNull(Foo foo)
{
foo.ID = 2;
foo = null;
}
}
class Foo
{
public int ID { get; set; }
}