I’m using this code to display Country names:
Shared Sub DisplayCountries()
Dim lstCounTry As List(Of String) = New List(Of String)
Dim ci As CultureInfo
For Each ci In CultureInfo.GetCultures(CultureTypes.SpecificCultures)
Dim ri As System.Globalization.RegionInfo = New System.Globalization.RegionInfo(ci.LCID)
If Not lstCounTry.Contains(ri.EnglishName) Then
lstCounTry.Add(ri.EnglishName)
End If
Next
lstCounTry.Sort()
For Each item In lstCounTry
Console.WriteLine(item)
Next
End Sub
Is there a way in .NET Framework to populate City name using same method?
There is no list of city names in the BCL.
As for using
RegionInfo– a region may have many cities, so even if that data existed, you would still need a way to select one.CultureInfois an even poorer match – not all cultures have a single country associated with them (many have several).You will need to implement something like this yourself.