If you have code like this:
class Program
{
static void Main(string[] args)
{
Test test = new Test();
test.PropOne = 123;
test.PropTwo = "testing";
ModifyTestClassWithRef(ref test);
}
public static void ModifyTestClassWithRef(ref Test test)
{
test.PropOne++;
test.PropTwo += "_abc";
}
}
public class Test
{
public int PropOne { get; set; }
public string PropTwo { get; set; }
}
Why does the compiler not provide a warning about "ref" not being necessary since it is unnecessary in this particular situation?