In LINQ, AsEnumerable() method is used to convert/cast specific types of given list items to its IEnumerable equivalent type.
Following is the syntax of using the LINQ AsEnumerable method to convert given list items to IEnumerable type.
If you observe the above syntax, we are converting the “numarray” list/collection to an IEnumerable type.
Following is the example of using the LINQ AsEnumerable method to convert the list of items to IEnumerable type.
C# Code
VB.NET Code
If you observe the above array, we convert the “numarray” list to IEnumerable type using the AsEnumerable() method.
Following is the result of the LINQ AsEnumerable() method example.
This is how we can use LINQ AsEnumerable() method to convert a list of items to an IEnumerable list.