"Swapnil" <Sw*****@discussions.microsoft.comwrote in message
news:6E**********************************@microsof t.com...
I want to copy the elements of one list to the other list.
Is there any function to do this operation in C#.
Plz explain with example.
You can use the AddRange method, which accepts any IEnumerable type, such as
another list:
List<WhateveroriginalList = new List<Whatever>();
originalList.Add(...); //Load original list
....
List<WhatevercopiedList = new List<Whatever>();
copiedList.AddRange(originalList);
//Now you have another list with a copy of all elements.
Note that if "Whatever" is a reference type, you will have copied the
references to the elements, not the contents of the elements.