Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# is in array

using System.Linq; //Then you can use linq Contains() method

string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"};
if(printer.Contains("jupiter"))
{Console.WriteLine("'jupiter' is in the array");}
Comment

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");
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: list.max c# 
Csharp :: No Entity Framework provider found for the ADO.NET provider with invariant name 
Csharp :: how to put double quotes in a string c# 
Csharp :: get char lowercase in c# 
Csharp :: list index out of range c# 
Csharp :: c# lambda join two tables 
Csharp :: when was the third world war 
Csharp :: contains c# 
Csharp :: Razor if-else statement 
Csharp :: 2d rotation unity 
Csharp :: asp.net core get root url in view 
Csharp :: c# multiline comment 
Csharp :: what is type unity 
Csharp :: what is the meaning of ?? in c# 
Csharp :: csharp datagridview filter column 
Csharp :: ef core set identity_insert off 
Csharp :: difference between class and struct 
Csharp :: array sorting c# 
Csharp :: check if file exist c# 
Csharp :: wpf arrow button 
Csharp :: c# clear all textboxes 
Csharp :: calling stored procedure in c# entity framework 
Csharp :: show snackbar without scaffold flutter 
Csharp :: C# Http.HttpRequestMessage 
Csharp :: getter setter c# 
Csharp :: c# get dictionary first key 
Csharp :: list to ienumerable c# 
Csharp :: unity c# struct 
Csharp :: while c# 
Csharp :: c# streamwriter add new line 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =