LINQ ToArray() MethodToArray() operator in LINQ is used to convert the input elements in the collection to an Array. Syntax of LINQ ToArray() operatorThe syntax of using the LINQ ToArray() operator to convert the collection to an array. C# Code In the above syntax, we are converting the collection of "countries" to an Array. Example of LINQ ToArray() operator in method syntaxIn this example, we are using LINQ ToArray() operator in method syntax to convert the input collection items to new array. In the above example, we have a List of type string "countries." By using the ToArray() method, we converted the list of "countries" List to an Array. To access these elements, we have iterated the array in a foreach loop and displayed it on the screen. OUTPUT: LINQ ToArray() operator in Query SyntaxThe example of using LINQ ToArray() operator in Query Syntax is: OUTPUT: Next TopicLINQ ToLookup() Method |