That's reasonable. Since it is possible you will alter the List<T>
later in the process, you need to make a copy of the original List<T>
.
You could think of postponing the process until you alter a value of the created list. Note however it is possible that you will alter the first list first.
Example:
List<String> first = new List<String>(new string[] {"foo","bar"});
List<String> second = first.ToList();
first[0] = "qux";
Now it is very hard to make sure that in that case the copy is made before altering the list. Furthermore it would be less efficient since each time a value is updated, one should first check if there are lazy copies and in that case start copying. Furthermore it could result in a burst/bubble: a large amount of work to be carried out that is eventually done after modifying a single value could result in a huge delay. Imagine that you are running a server where people "fork" a popular list. Eventually that list is indeed modified. It could result in the fact that the user will wait for minutes because the server starts making copies for all people that forked that list in the first place. It's better to spread computation over time such that the variance over delay is smaller.
The case of a .ToReadOnlyCollection
is different. In that case you define a wrapper around the original list. In case you modify the original list, that change is reflected in the read-only collection as well. So you can link to the previous list. For instance:
$ csharp
Mono C# Shell, type "help;" for help
Enter statements below.
csharp> List<String> first = new List<String>(new string[] {"foo","bar"});
csharp> var sec = first.AsReadOnly();
csharp> sec
{ "foo", "bar" }
csharp> first[0] = "qux";
csharp> sec
{ "qux", "bar" }