I’m trying to integrate two systems that deal with images. One system provides an image as a sbyte[] and the other uses a BitArray. I need to take the data from the sbyte[] and convert it into a BitArray. Anyone know how to do this?
Thanks, Paul
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.
The simplest way would be to convert the
sbyte[]to abyte[]and then pass it into the normalBitArrayconstructor. If you’re using .NET 3.5 that’s easy with LINQ:This is assuming you’re executing in an unchecked context already. Otherwise you might want to make the conversion explicitly unchecked: