Click here to Skip to main content
15,916,091 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get the input values at the time of scrolling... Pin
spalanivel21-Jul-09 21:22
spalanivel21-Jul-09 21:22 
GeneralRe: Get the input values at the time of scrolling... Pin
Nagy Vilmos21-Jul-09 23:36
professionalNagy Vilmos21-Jul-09 23:36 
GeneralRe: Get the input values at the time of scrolling... Pin
spalanivel22-Jul-09 1:00
spalanivel22-Jul-09 1:00 
QuestionHow do you find value of bits in byte Pin
gwithey20-Jul-09 23:34
gwithey20-Jul-09 23:34 
AnswerRe: How do you find value of bits in byte Pin
Mirko198020-Jul-09 23:43
Mirko198020-Jul-09 23:43 
GeneralRe: How do you find value of bits in byte Pin
gwithey21-Jul-09 0:30
gwithey21-Jul-09 0:30 
GeneralRe: How do you find value of bits in byte Pin
gwithey21-Jul-09 0:44
gwithey21-Jul-09 0:44 
AnswerRe: How do you find value of bits in byte Pin
monstale20-Jul-09 23:47
monstale20-Jul-09 23:47 
GeneralRe: How do you find value of bits in byte Pin
gwithey21-Jul-09 0:20
gwithey21-Jul-09 0:20 
GeneralRe: How do you find value of bits in byte Pin
monstale21-Jul-09 0:53
monstale21-Jul-09 0:53 
AnswerRe: How do you find value of bits in byte Pin
0x3c020-Jul-09 23:51
0x3c020-Jul-09 23:51 
AnswerRe: How do you find value of bits in byte Pin
DaveyM6921-Jul-09 2:01
professionalDaveyM6921-Jul-09 2:01 
GeneralRe: How do you find value of bits in byte Pin
PIEBALDconsult21-Jul-09 4:18
mvePIEBALDconsult21-Jul-09 4:18 
AnswerRe: How do you find value of bits in byte Pin
Luc Pattyn21-Jul-09 2:05
sitebuilderLuc Pattyn21-Jul-09 2:05 
Hi,

this code works like a bit getter on a byte array:
public static bool bitGetter(byte[] bytes, int index) {
    int byteNumber=index/8;
    int bitNumber=index%8;
    int bitMask=1<<bitNumber;
    int byt=bytes[byteNumber];
    int bit=byt&bitMask;
    if (bit==0) return false;
    return true;
}


and the condensed version is:

public static bool bitGetter(byte[] bytes, int index) {
    return 0!=bytes[index/8]&(1<<(index%8));
}


Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

QuestionHow to find the needless references in a project ? Pin
chenxiang20-Jul-09 19:55
chenxiang20-Jul-09 19:55 
AnswerRe: How to find the needless references in a project ? Pin
stancrm20-Jul-09 20:41
stancrm20-Jul-09 20:41 
QuestionPlay Live Remote IP Cam Video in Windows application Player using C#.Net Pin
vasanth arivali20-Jul-09 19:02
vasanth arivali20-Jul-09 19:02 
AnswerRe: Play Live Remote IP Cam Video in Windows application Player using C#.Net Pin
Jimmanuel21-Jul-09 1:04
Jimmanuel21-Jul-09 1:04 
GeneralType conversion Pin
Mycroft Holmes20-Jul-09 16:46
professionalMycroft Holmes20-Jul-09 16:46 
GeneralRe: Type conversion Pin
harold aptroot20-Jul-09 16:53
harold aptroot20-Jul-09 16:53 
GeneralRe: Type conversion Pin
Mycroft Holmes20-Jul-09 18:11
professionalMycroft Holmes20-Jul-09 18:11 
GeneralRe: Type conversion PinPopular
PIEBALDconsult20-Jul-09 17:10
mvePIEBALDconsult20-Jul-09 17:10 
GeneralRe: Type conversion Pin
Mycroft Holmes20-Jul-09 18:09
professionalMycroft Holmes20-Jul-09 18:09 
GeneralRe: Type conversion Pin
PIEBALDconsult20-Jul-09 19:01
mvePIEBALDconsult20-Jul-09 19:01 
GeneralRe: Type conversion Pin
harold aptroot20-Jul-09 19:06
harold aptroot20-Jul-09 19:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.