KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is this the only way of passing a List to a method and editing that List, without modifying the original List? class CopyTest1 { List<int> _myList = new List<int>(); public CopyTest1(List<int> l) { foreach (int num in l) { _myList.Add(num); } _myList.RemoveAt(0); // no effect on original List } }
Tags (comma-separated)
Save Edits
Cancel