473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Manipulating BITS in C#

13
Hi,

Now, if we have a String we can manipulate its basic components
(Char). How about a Byte, are we able to manipulate its (Bits) one
by one.

I found a class Bit in Java, how about C#.


What do you think, guys !?
Aug 13 '07 #1
8 1694
kenobewan
4,871 Expert 4TB
There are no bits in byte ;).
Aug 13 '07 #2
Plater
7,872 Expert 4TB
There is an object called a BitArray. I have only found a few uses for it though.

(Also you can have an array of boolean type, but there is no native method for them to turn into a byte I don't think)
Aug 13 '07 #3
HTB
13
kenobewan,

:) you're right. I thought the data type Byte is the normal byte which
consists of 8 bits. anyways...
Aug 13 '07 #4
HTB
13
So, can we get a byte via read() and convert it to BitArray and then
we manipulate the array one by one !!!!?
Aug 13 '07 #5
TRScheel
638 Expert 512MB
So, can we get a byte via read() and convert it to BitArray and then
we manipulate the array one by one !!!!?
yes but a bitarray pretends they are all bools, FYI
Aug 13 '07 #6
Plater
7,872 Expert 4TB
What about a union of a bool[8] and a Byte ?
Aug 13 '07 #7
TRScheel
638 Expert 512MB
What about a union of a bool[8] and a Byte ?
I now pronounce you Pieces and A Whole
Aug 13 '07 #8
Plater
7,872 Expert 4TB
Well scratch that.
There are no Unions in C#.
You can mimic them, but only down to the byte level, not the bit level
Aug 13 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Kristian Nybo | last post by:
Hi, I'm writing a simple image file exporter as part of a school project. To implement my image format of choice I need to work with big-endian bytes, where 'byte' of course means '8 bits', not...
2
by: James Dean | last post by:
Could anybody tell me the most efficient way to set the bits in a 1Bpp class. I am reading in byte lines of an image. The byte array tells me what what bits are turned on or off.....i do bit...
21
by: felixnielsen | last post by:
If im not mistaken, a char variable allocates 1 byte of memory, as it is the case with a bool variable. I need 2 bool and 1 char variable which only need to contain a value between 0 and 63...
29
by: Halid Umar A M | last post by:
Hi All, I m Halid Umar, network security research student. I will explain my situation and give me hint if you can. I expect reply from you all. * I have to handle numbers that have more than...
7
by: pbd22 | last post by:
Hi. How Do I "UPDATE" a previously created string? I have a problem where an XML string created in an event handler fails because the string doesn't "UPDATE" each time the event hanlder fires,...
8
by: brainflakes.org | last post by:
Hi guys, I need to manipulate binary data (8 bit) stored in a 2 dimensional array. I've tried various methods (arrays, using a string filled with chr(0), using gd lib) and so far the fastest...
11
by: Mack | last post by:
Hi all, I want to write a program to count number of bits set in a number. The condition is we should not loop through each bit to find whether its set or not. Thanks in advance, -Mukesh
2
by: Allen | last post by:
I'm using Python to do some simple network programming, and found the struct module very useful for such things, but is there a way to easily manipulate bitsets such as a 16 bit word being split...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.