How would I convert the following to a VB.NET predicate using Array.Find?
Private Function FindCulture(ByVal Code As String) As Globalization.CultureInfo
'
Dim AllCultures As Globalization.CultureInfo() = Globalization.CultureInfo.GetCultures(Globalization.CultureTypes.AllCultures)
'
For Each Culture As Globalization.CultureInfo In AllCultures
If Culture.TwoLetterISOLanguageName = Code Then
Return Culture
End If
Next
'
Return Nothing
'
End Function
Private Function FindCulture(ByVal Code As String) As Globalization.CultureInfo
Dim AllCultures As Globalization.CultureInfo() = Globalization.CultureInfo.GetCultures(Globalization.CultureTypes.AllCultures)
Return Array.Find(AllCultures, Function(s) s.TwoLetterISOLanguageName = Code)
End Function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With