passing parameters...

Hello, I have this problem:

void append (Node n) { //here construct the my list }
void remove(Node n) { find and remove n from the list and change the pointers as well }
void myMethod (LinkedList list, Node n) {
list.remove(n);
}

static main () {
List <Node> linkedlist = new List <Node> ll;
for (int i=0; i< 10; i++) ll.append(new Node (i));
myMethod (ll, new Node (4));
//here I'd like that linkedList wasn't changed !!!! (but it's changed)
}

Can I do value passage in this case? thanks
[593 byte] By [mickey0] at [2007-11-20 11:48:54]
# 1 Re: passing parameters...
You can pass a clone/copy or make sure that the called method makes copy (and don't modify the original list).

Another option is to pass a IEnumerable so that the called method only can enumerate the contents of the collection (list, array etc.), but not modify it.

- petter
wildfrog at 2007-11-9 11:37:09 >