C
C#15mo ago
aj

❔ What's the easiest way to see if a list contains a certain string?

What's the easiest way to see if a list contains a certain string?
5 Replies
Pobiega
Pobiega15mo ago
.Contains, assuming the list is a list of strings
aj
aj15mo ago
would i have to put it through a for loop? or would .Contains by itself work
Pobiega
Pobiega15mo ago
List<T> has a Contains(T) method that returns a bool You don't need to loop
aj
aj15mo ago
ohhh i see, thanks a lot!
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.