February 6th, 2011, 10:39 AM
How to copy one element of a Generic Collection?
I need to copy one element of a generic collection and add it to the list. Something similar to this:
private List<CalculationResult> cantileverResults = new List<CalculationResult>();
The problem with this solution is that when I modify the new element, the previousIndex element changes as well. I believe this is because they are reference-type, not value-type. How can I just copy (clone?) the information from one element to another without affecting each other any further?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.