C# Calling on a String Array?

Hey there, I am, trying to use a String Array to use as a filter system for character names so you cannot use fowl language as a character name.

This is what I have it set up as:
namespace TextAdventure
{
class Program
{

        static void Main(string[] args)
        {
        bool curses = false;
        bool propername = false;
        string name;
        string[] names = new string[20]
        names[0] = "Damn";
        names[1] = "Leeroy Jenkins";

        do
        {
           name = Console.ReadLine();
        if(name == names[0])
        {
          curses = true;
          Console.WriteLine("The value entered is not permitted.");
        }
        else
        {
           propername = true;
        }
        }
        while(!propername);
}
}
}

I want to be able to check if the entered name is any value inside of the Array instead of just one at a time as that would mean I needed 20 if Statements and that is obviously not practical and just plain silly.

Any ideas?

You don’t have to do 20 if statements… Whenever you put something into an array, 99% of the time it’s exactly because you want to avoid writing code to each of those values manually and instead want to loop through all the values with one piece of code.

That’s the case here as well.

        public static void Main(string[] args)
		{

			Console.Write("What is your name? ");
			string name = Console.ReadLine();
		
			bool curses = false;
            // it's a proper name to begin with only if the user actually entered something
			bool propername = (name.Trim().Length > 0);

			string[] curseWords = new string[]{"Damn", "Leeroy Jenkins"};

            // loop the list of curse words and compare the name to each of them
			for (int i = 0; i < curseWords.Length && propername; i++)
			{
				// comapre the lower case version of "name" to lower case version of each curse word 
				// so you don't have to have case-specific versions of curse words in the array
				if (name.ToLower().Contains(curseWords*.ToLower()))*
  •  		{*
    
  •  			curses = true;*
    
  •  			propername = false;*
    
  •  			break;*
    
  •  		}*
    
  •  	}*
    
  •  	if (!curses && propername)*
    
  •  		Console.WriteLine("Your name is " + name);*
    

else
Console.WriteLine(“The value entered is not permitted.”);

  •  }*