© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
44 replies
Matt

Union? of two binary arrays

Let's say we have two byte arrays:
byte[] ba1 = { 01, 01, 00, 00 };
byte[] ba2 = { 01, 00, 01, 00 };
byte[] ba1 = { 01, 01, 00, 00 };
byte[] ba2 = { 01, 00, 01, 00 };

I want to perform some operation on the arrays such that if the first byte in BOTH arrays is 0, then the resulting array's first byte is 0 but if EITHER byte is a 1, then the resulting array's first byte is a 1. (Extend this logic to each byte) Thus, the resulting array should be:
byte[] baRes = { 01, 01, 01, 00 }
byte[] baRes = { 01, 01, 01, 00 }

Is there any nice function that will do this for me?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Implementing binary search to search through multiple arrays
C#CC# / help
3y ago
❔ Combine two arrays by alternating items?
C#CC# / help
3y ago
Use of inline arrays to model arrays of structs
C#CC# / help
6mo ago
beginner, two questions about arrays and counting?
C#CC# / help
2y ago