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

  • SEARCH
  • Home
  • 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 8500791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:02:02+00:00 2026-06-11T01:02:02+00:00

I have a string which represents a binary number: 1010, which represents a 10(ten)

  • 0

I have a string which represents a binary number: “1010”, which represents a 10(ten) in decimal.

I need to write this string into a Stream but keeping the binary format. When normally you want to write a string, .Net will save it converting the current string into a byte array and then putting those bytes into the string, I do not want that, because the bytes that I want to contain my stream is that I have into the string “1010” for example.

How I do this???

  • 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-06-11T01:02:04+00:00Added an answer on June 11, 2026 at 1:02 am

    If “1010” is a string, you can still write it to a stream and preserve the format, provided the receiving end uses the proper encoding. Of course, you could use a StreamWriter and just write the string as a string.

    UPDATE

    Ok, so your comments seem to clarify your question a little. So it seems like you want to convert a base-2 string into a byte, so that you aren’t storing multiple bytes to represent in text what you can represent in a single byte. Is that fair? If so, use Convert.ToByte(String, Int32), and specify 2 for the base. Then you have a byte corresponding to your string and you can write it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if this is the best approach but I have some string which
Here I have string like this 1322485986.672901000 , data type is string which represents
I have this string 11110000 , which represents a byte . I want to
I have a string which I need to verify if it's a Country code.
I have string variable which represents the full path of some file, like: x
I have a string which represents a multidimensional array in the format: [[A, a],
I have a dilemma that goes like this. I have a string that represents
This may be a silly question but... Say I have a String like 4e59
I have a stream of bytes (given by a BufferedInputStream) which represents a sequence
I have a four-byte string read from a binary file, which is supposed to

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.