Try this:
Dim ToLower_fileExtensions = From w in fileExtensions Select IF(w Is Nothing, Nothing, w.ToLower())
문제
How Can I set to lower all the elements of an string array using LINQ?
Dim fileExtensions() As String = {"Mp3", "mP4", "wMw", "weBM", Nothing, ""}
Dim ToLower_fileExtensions = fileExtensions().Select...
(not using For)
해결책
Try this:
Dim ToLower_fileExtensions = From w in fileExtensions Select IF(w Is Nothing, Nothing, w.ToLower())
다른 팁
The easy and efficient way:
For i As Int32 = 0 To fileExtensions.Length - 1
fileExtensions(i) = fileExtensions(i).ToLower()
Next
Since you've asked for linq, this is less efficient since it needs to create a new collection:
fileExtensions = fileExtensions.Select(Function(str) str.ToLower()).ToArray()
Just a simple and generic function I've did based on @dasblinkenlight solution:
Private Function ArrayToLower(ByVal [Array] As IEnumerable) As IEnumerable
Return From str In [Array] _
Select If(String.IsNullOrEmpty(str), _
String.Empty, _
str.ToLower())
End Function
PS: Nice to convert it to a extension