Answers for "how to check if an integer is in array c#"

C#
11

how to check if a value is inside an array c#

/*Make sure to add 
using System.Linq;
*/


string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"};
if(printer.Contains("jupiter"))
{
    Process.Start("BLAH BLAH CODE TO ADD PRINTER VIA WINDOWS EXEC"");
}
Posted by: Guest on March-31-2020
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
0

how to check if an integer is in array c#

//Add necessary namespace
using System.Linq;
//Example
string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"};
//using .Contains() method
if(printer.Contains("jupiter"))
{
    Process.Start("BLAH BLAH CODE TO ADD PRINTER VIA WINDOWS EXEC"");
}
Posted by: Guest on March-01-2020

Code answers related to "how to check if an integer is in array c#"

C# Answers by Framework

Browse Popular Code Answers by Language