Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRohit Gopalan
81,945 PointsExtension method in Linq
With the code below, I am not getting the correct output of False. Any suggestions to improve my code would be much appreciated.
using System.Collections.Generic;
using System.Linq;
namespace Treehouse.CodeChallenges
{
public static class ContainsAnyExtension {
public static bool ContainsAny(this string source, IEnumerable<string> stringsToMatch) {
return stringsToMatch.Contains(source);
}
}
}
1 Answer
Carling Kirk
Treehouse Guest TeacherHi Rohit!
The stringsToMatch
should be able to be partially found in the source
string. Try using a combination of the Contains
method and the Any
method.