Can I use 'Switch Case' or 'If-Else-Elsif' inside LINQ?

Hello guys,

I need to make a linq-query to exchange an element of a column for another, for example: “BR” → “Brazil”. But for each acronym, it has a different word.

Someone can help me, please.

Why does it have to be LINQ? Very simple with activities.

You could use nested inline if.

E.g.

country = If (abr = "BR", "Brazil", If (abr = "US", "USA", "Unknown"))

But in this case I think it would be better to use a dictionary as a translation table instead. E.g. create a new Dictionary(Of String, String) and add the countries.

dict("BR") = "Brazil"
dict("US") = "USA"
...

country = dict(abr)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.