How can we convert an 8bit binary to an array and find the index of high(1 s) in that binary ?
Jump to Post
Let me know if this Linq needs any clarification:
//To generate the bool array bool myBits = (from bit in Convert.ToString(myByte, 2).PadLeft(8, '0') select bit == '1') .ToArray<bool>(); //To display myBits.ToList().ForEach(y => Console.Write(y ? "1" : "0"));
All 8 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.