M
M
Maxim Siomin2020-08-24 19:23:12
C++ / C#
Maxim Siomin, 2020-08-24 19:23:12

Is there a similar solution in c#?

Python has this operation:

if smth in smthList:
    pass

Is there such a built-in solution in c#?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2020-08-24
@MaxSiominDev

Well, the List class has a Contains method, for example. Quite analogous.

V
Vasily Bannikov, 2020-08-25
@vabka

if (smthList.Contains(smth))
    DoBusiness();

List.Contains(T) or Enumerable.Contains

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question