Below some forms of "Like".
string.Contains("pattern") is equivalent to LIKE '%pattern%'
string.StartsWith("pattern") is equivalent to LIKE 'pattern%'
string.EndsWith("pattern") is equivalent to LIKE '%pattern'
Here's an example.
List<BaseClaim> BaseClaims = new List<BaseClaim>()
{
new BaseClaim(){ WPId = "11123411" }, //match 1
new BaseClaim(){ WPId = "11123123" }, //match 2
new BaseClaim(){ WPId = "44423411" }, //match 3
new BaseClaim(){ WPId = "444AAAA" }, //match 3
new BaseClaim(){ WPId = "444BBBB" }, //match 3
new BaseClaim(){ WPId = "444QWQEQW" }, //match 3
new BaseClaim(){ WPId = "2314" },
new BaseClaim(){ WPId = "3214" }
};
List<UserProfile> UserProfiles = new List<UserProfile>()
{
new UserProfile(){ WPId="%112341%", ID="1459" }, //match 1
new UserProfile(){ WPId="%123", ID="1459" }, //match 2
new UserProfile(){ WPId="444%", ID="1459" }, //match 3
new UserProfile(){ WPId="5555", ID="1459" },
new UserProfile(){ WPId="2222", ID="1459" },
new UserProfile(){ WPId="1111", ID="4444" },
};
char[] asterisk = { '%' };
List<BaseClaim> result = BaseClaims.Where(b => UserProfiles.Where(u => u.ID == "1459").Any(u => u.WPId.StartsWith("%") && u.WPId.EndsWith("%") ? b.WPId.Contains(u.WPId.Trim(asterisk)) :
u.WPId.StartsWith("%") ? b.WPId.EndsWith(u.WPId.Trim(asterisk)) :
u.WPId.EndsWith("%") ? b.WPId.StartsWith(u.WPId.Trim(asterisk)) :
false)).ToList();
//this will result to getting the first 3 BaseClaims