comparing byte arrays in linq

Posts   
 
    
jimph
User
Posts: 63
Joined: 06-Jun-2013
# Posted on: 12-Sep-2013 16:42:02   

Hi, I have a simple linq query below that requires comparing 2 byte arrays (same size) in where clause. The framework returns error that SequenceEqual() is not supported by the linq provider. Please would you suggest an alternative (desperately needs this to worksimple_smile

Many thanks

        var metaData = new LinqMetaData(adapter);
        var q = from v in metaData.Table1
                join w in metaData.Table2 on v.Id equals w.Id
                where bytes16.SequenceEqual(w.bytes16)
                select v;
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Sep-2013 07:38:52   

There is no SQL function mapping for SequenceEqual. Just use "==':

var metaData = new LinqMetaData(adapter);
            var q = from v in metaData.Table1
                    join w in metaData.Table2 on v.Id equals w.Id
                    where w.bytes16 == bytes16
                    select v;
David Elizondo | LLBLGen Support Team