In a LINQ query:
from c in results
where c.ByteField == byteData
select c;
I’m getting no results from this even though the bytes are the same:
byte[5] = 49, 50, 51, 52, 53
How do I compare bytes properly in LINQ to Objects?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In LINQ to Objects (as your post suggests in the title), you can use
IEnumerable.SequenceEqual():Unfortunately, it looks like you’re using LINQ to SQL (or Entity Framework) based on your use of
context. There’s no SQL equivalent of SequenceEqual so this won’t work in that case.