Monday, 26 August 2013

Is there possibility to "assign sth to this object", c#

Is there possibility to "assign sth to this object", c#

Is there a possibility in c# to make something like this:
class MyClass
{
private int id;
public MyClass
{
this.id = 2;
}
public void get()
{
// can I assign new object to this object?
this = NewClass.create();
}
}
static class NewClass
{
public static MyClass create()
{
return new MyClass();
}
}
I know it's wrong, I'm just curious if there is such a possibility.

No comments:

Post a Comment