C# Equivalent of pythons ā€œif .. inā€ function? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

C# Equivalent of pythons ā€œif .. inā€ function?

In python you can check if a certain set of characters or etc is in a string with: if ā€œstringā€ in variable: What would the C# version of this be? Or do I have to use regular expressions ?

19th Sep 2018, 4:33 PM
Luca
Luca - avatar
1 Resposta
+ 6
namespace SoloLearn{ class Program{ static void Main(string[] args){ int[] arr = {1, 2, 3, 4}; int num = 4; Console.WriteLine(arr.Contains(num)); } } }
19th Sep 2018, 5:17 PM
Mert Yazıcı
Mert Yazıcı - avatar