T
Timothy V
Hi everyone,
I'm having trouble with the keyword this inside a class. The following code
is an example of the problem, not what I am actually doing.
public class C
{
public C() {}
public string s;
public void Function()
{
C c = new C();
this = c;
}
}
Basically it brings a compiler error CS1604 (Cannot assign to 'variable'
because it is read-only).
My question is, how can I do this? Is it possible?
Thank you,
Tim.
I'm having trouble with the keyword this inside a class. The following code
is an example of the problem, not what I am actually doing.
public class C
{
public C() {}
public string s;
public void Function()
{
C c = new C();
this = c;
}
}
Basically it brings a compiler error CS1604 (Cannot assign to 'variable'
because it is read-only).
My question is, how can I do this? Is it possible?
Thank you,
Tim.