I have a code that looks like this:
using (DC dc = new DC())
{
f(dc.obj, a);
}
void f(DC dc, int a)
{
...
dc.obj = a;
}
It doesnt work - complains about object reference and non-static fields. This is a console application, so it has Main() function. How should I make it work? I tried adding references as it asked:
I have a code that looks like this:
using (DC dc = new DC())
{
f(ref dc.obj, a);
}
void f(ref DC dc, int a)
{
...
dc.obj = a;
}
but it still didnt work