LINQ to String Array means writing LINQ queries on a string array to get the required data. If we use LINQ queries on string arrays, we can quickly get the required elements without writing much code.
Following is the syntax of writing LINQ queries on string arrays to get the required elements from array collection.
If you observe the above syntax, we wrote the LINQ query to get data from the “arr” string array.
Following is the example of LINQ to String Array to get elements from the string array sequence where the name starts with “S”.
If you observe the above code, we used the LINQ query on the “arr” string array to get elements whose name starts with “s”. Here, we used ToLowerInvariant() property to convert string array elements to lowercase and compare because LINQ queries are case sensitive.
Following is the result of the LINQ to String Array Example.
This is how we can use LINQ queries with string arrays to get the required data.