I have a two list objects, and I'm trying to copy the value of one list to the other. Ideal coding would be this:
List<List<int>> x = new List<List<int>>();
List<int> temp = new List<int>();
List<List<int>> y = new List<List<int>>();
int myCount;
foreach (List<int> t in y)
{
myCount = t.Count;
for(int w = 0; w <= t.Count; w++)
{
temp = new List<int>();
temp = t;
temp.Insert(w,n);
x.Add(temp);
}
}
Clearly, temp = t; won't be a value copy, but what's the easiest way to make this assignment a value copy instead of a ref copy.
I tried t.ToList(), but intellisense doesn't see that (nor is it listed in the List definition on the MSN help page). I tried "MemberwiseClone" but this also isn't exposed in intellisense. It's times like these where I miss pointers... :)