Answers for "find int in array c#"

C#
0

find items in array c#

string[] names = { "Steve", "Bill", "Bill Gates", "Ravi", "Mohan", "Salman", "Boski" };
var stringToFind = "Bill";
 
var result = Array.Find(names, element => element == stringToFind); // returns "Bill"
Posted by: Guest on May-16-2021
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

C# Answers by Framework

Browse Popular Code Answers by Language