dotnet / dotnet/dotnet-api-docs
Could you specify what happens if source is already a List<T>
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
I know that ToList() creates a shallow clone of the source, but is this guaranteed to be true for all versions of .NET? Sometimes I want to create a shallow clone of List<T> and I want to be certain that ToList() does that.
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: a22a1d4d-3345-e3a4-e171-ccf602efbab8
* Version Independent ID: 4cfd3f7b-dfa8-3b0d-44d3-a251deab7b5b
* Content: [Enumerable.ToList(IEnumerable<TSource>) Method (System.Linq)](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.tolist?view=netframework-4.7.2)
* Content Source: [xml/System.Linq/Enumerable.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Linq/Enumerable.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**
Contributor guide
Assessment
This issue has not been assessed yet.