Click here to Skip to main content
15,904,926 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
High every one !
how can i give more than one name unified name
example
i have the following strings : "U.S" , "Germany" , "France"
and i want to give them name : country
when i compare incoming word to my input i would compare
if (word == country )
{
do some thing
}
Posted

1 solution

You can add the countries to an array or to a list and then loop through that list if that word matches. For example code:

C#
string[] arrCountries = new string[] { "U.S", "Germany", "France" };

foreach(string arrItem in arrCountries)
{
   if(arrItem == word)
   {
      //do something
   }
}


Good luck
 
Share this answer
 
v2
Comments
tarekwarak0 2-Dec-11 20:59pm    
thank you for replying ,but can i use enumeration
tarekwarak0 2-Dec-11 21:13pm    
like this ?

public class A
{
public enum MyEnum {أو , و}

}
class Program
{
static void Main(string[] args)
{
//House s = new House(); s.Display();
A dd = new A();
if ("أو" is A.MyEnum)
Console.WriteLine("SSSS");



}
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900