I need to check if my byte array contains string in LinQ Where() method.
At the moment I have something like:
public static bool ContainsSequence(byte[] toSearch, byte[] toFind)
{
    for (var i = 0; i + toFind.Length < toSearch.Length; i++)
    {
        var allSame = true;
        for (var j = 0; j < toFind.Length; j++)
        {
            if (toSearch[i + j] != toFind[j])
            {
                allSame = false;
                break;
            }
        }
        if (allSame)
        {
            return true;
        }
    }
    return false;
}
var data = MyCollection.Where(x => ContainsSequence(x.ByteArrayValue, myStringToByteArray);
but I'm getting exception:
LINQ to Entities does not recognize the method ContainsSequence
I've read somewhere that I can rewrite ContainsSequence method to Linq.Extensions.Extension but I have no idea how.
Can someone direct me to a solution?