list class : Copy() method
Description
It returns a shallow copy of the caller.
Syntax
listInstance.Copy()
Arguments
None
Return value
Class | Description |
list | A shallow copy of the caller. |
Sample code
1: | list{string} stringList = new list{string}(); |
2: | stringList.Add("a"); |
3: | stringList.Add("b"); |
4: | list{string} copyList = stringList.Copy(); |
5: | string first = copyList.FirstChild; // The value of first is "a"; |
6: | string last = copyList.LastChild; // The value of last is "b"; |
Notes
Please be aware that this method returns a shallow copy of list. Namely, the caller list and the returned list refer to the same child element.
None
Links for reference
None