Alex Rivera | Logout

how to copy a list to a new list, or retrieve list by value in c#

Asked 2009-11-24T23:14:07.773
26

I noticed in c# there is a method for Lists: CopyTo -> that copies to arrays, is there a nicer way to copy to a new list? problem is, I want to retrieve the list by value to be able to remove items before displaying them, i dont want the original list to be modified, that too doesnt seem to be easily attainable, any ideas?

Edit
Report

1 Answer

2

Just create a new List and use the appropriate constructor:

IList<Obj> newList = new List<Obj>(oldList);
answered 2009-11-24T23:17:46.900

Your Answer