Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7540303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:36:34+00:00 2026-05-30T07:36:34+00:00

In C#, how would I go about setting 2 bytes where the first 10

  • 0

In C#, how would I go about setting 2 bytes where the first 10 bits represent one decimal value and the next 6 represent a different decimal value?

So if the first value was ‘8’ (first 10 bits) and the second ‘2’ (remaining 6 bits), I need to end up with ‘0000001000 000010’ inside a byte array.

Thanks!
Ad

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:36:36+00:00Added an answer on May 30, 2026 at 7:36 am
    UInt16 val1 = 8;
    UInt16 val2 = 2;
    UInt16 combined = (UInt16)((val1 << 6) | val2);
    

    If you need it in a byte array, you can pass the result to the BitConverter.GetBytes method.

    byte[] array = BitConverter.GetBytes(combined);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Magento Community v1.5.1.0, how would one go about setting the starting (or next)
I needed to know how one would go about setting up a default avatar
How would one go about setting up some hotkeys for commonly used SVN actions
I'm curious to know how I would go about setting up my service to
How would I go about setting a link to perform certain functions like hide
Hay, i was wondering how i would go about setting up django so that
How would I go about setting the default font for all JLabel instances. Instead
If so how would I go about setting that up?
I have a SplitContainer and was wondering how I would go about setting a
How would I go about setting the content size for a scrollview , when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.