Assign to the current object "this"

Jan 18 2005 12:04 PM
Hi, I am trying to assign to the current object in my code as follows. public class Stack { public void push() { } public void pop() { } public void reverse() { object x; ArrayStack t = new ArrayStack(5); while(this.depth != 0) { this.pop(out x); t.push(x); } swap(ref t); } public void swap(ref Stack s) { Stack temp = s; s = this; this = temp; --> Compile error on this line stating "this is a readonly variable" } } Is there a workaround for this error? Thanks!