Javatpoint Logo
Javatpoint Logo

LINQ ToList() Method

In LINQ, the ToList operator takes the element from the given source, and it returns a new List. So, in this case, input would be converted to type List.

Syntax of LINQ ToList() operator

The syntax of using the LINQ ToList() to convert the input collection to list.

C# Code

In the above syntax, we are converting "countries" collection to list using the LINQ ToList() operator.

Example of ToList() operator in method syntax

The example of using the LINQ ToList() to convert the input collection to List in method syntax.

C# Code

OUTPUT:

LINQ ToList() Method

In the above example, we are converting countries collection to List by using the LINQ ToList() method.

Example of ToList() operator in Query Syntax

The example of using the LINQ ToList() operator in Query Syntax

OUTPUT:

LINQ ToList() Method





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA