المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : What is best way to declare constants set?



C# Programming
07-28-2011, 07:00 PM
Hi,
I have many constants, each recurring as per country and declared in class as below:

class CountryRequests{ public const string JAP_ABC="JAP_012686"; public const string JAP_PQR="JAP_012457"; public const string JAP_POP="JAP_0178WE";//many more public const string US_ABC="US_015788"; public const string US_PQR="US_077895"; public const string US_POP="US_8726JI";//many more public const string EGN_ABC="GB_678756"; public const string ENG_PQR="GB_567766"; public const string ENG_POP="GB_8962KL";//many more}
and I have multiple functions each accessing string for every country, evaluated as
if(country == 'JAP'){//call function with JAP_ABC}else if(country == 'US'){//call function with US_POP}else if(country == 'UK'){//call function with ENG_POP}
occuring multile times.

What is best coding here. I cannot change from CountryRequests class to collection as it is used by multiple projects.
Please advice.
Thank you.
***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****