Any way to do this function?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ºa¤Ö

    Any way to do this function?

    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


  • Dale

    #2
    RE: Any way to do this function?

    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?
    --
    Dale Preston
    MCAD C#
    MCSE, MCDBA


    "ºa¤Ö" wrote:
    [color=blue]
    > 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
    >
    >
    >[/color]

    Comment

    • john smith

      #3
      Re: Any way to do this function?

      ºa¤Ö wrote:[color=blue]
      > 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
      >
      >[/color]

      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.

      Comment

      Working...