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 Answer
+ 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