I've a list defined as:
List<string> content = new List<string>(){ "Hello This", "This is", "This" };
I want a code to find if the list contains the Keyword This, and if yes get its first occurrence.
Existing Code :
foreach(string line in content){
if(line.Contains("This"))
return line;
}
I want to simply and know if some other alternative is there. If we know the complete string then we could use List.Contains, but for a substring, how to proceed?
USING .NET 2.0. Please suggest without using LINQ.