Answers for "c# contains list"

C#
1

c# arraylist contains

IList arList = new ArrayList();
arList.Add(100);
arList.Add("Hello World");
arList.Add(300);

Console.WriteLine(arList.Contains(100)); // true
Posted by: Guest on June-24-2020
0

c# string contains any of list

//linq
bool b = listOfStrings.Any(s=>myString.Contains(s));
//shorter but less clear
bool b = listOfStrings.Any(myString.Contains);
Posted by: Guest on July-06-2021
0

list contains type c#

if (within.OfType<Ball>().Any())
Posted by: Guest on June-24-2020
0

c# check list of objects for value

var matches = myList.Where(p => p.Name == nameToExtract);
Posted by: Guest on July-27-2020

C# Answers by Framework

Browse Popular Code Answers by Language