Answers for "how to know if an element is in an array c#"

C#
1

how to know if an element is in an array c#

string[] names = "John", "Susan", "Sophie";
if (names.Contains("John") //Using Contains you can know if a specific value is on an array
    {
    Console.WriteLine("John is a name");
    }
Posted by: Guest on October-25-2020

Code answers related to "how to know if an element is in an array c#"

C# Answers by Framework

Browse Popular Code Answers by Language