Any way to do this function?

  • Thread starter Thread starter ºa¤Ö
  • Start date Start date
º

ºa¤Ö

I have a class named country and have following properites

string EngName
string ChiName

How to do if user request EngName, then it can return EngName, if user
request ChiName, if can return ChiName
but i do not want to using if-then-else since it maybe have KrName, ThaiName
in the furture.

Thanks

m(_ _)m
 
If EngName and ChiName are properties then you already have the behavior you
are asking for: If you request the value of a property, that's what you'll
get.

I suspect there must be more to your question. Can you provide more
information?
 
ºa¤Ö said:
I have a class named country and have following properites

string EngName
string ChiName

How to do if user request EngName, then it can return EngName, if user
request ChiName, if can return ChiName
but i do not want to using if-then-else since it maybe have KrName, ThaiName
in the furture.

Thanks

m(_ _)m

That's not how localization is usually done. You'd want something more like

string CountryName

which is looked up from a resource file depending on the user's locale
automatically... I'm sure if you look into any localization article
you'll find tons of such infos.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top