Click here to Skip to main content
15,919,121 members
Home / Discussions / C#
   

C#

 
GeneralRe: database connection problem Pin
Erdinc277-Dec-09 1:19
Erdinc277-Dec-09 1:19 
QuestionConverting BitArray to string Pin
Joe Rozario6-Dec-09 21:37
Joe Rozario6-Dec-09 21:37 
AnswerRe: Converting BitArray to string Pin
dan!sh 6-Dec-09 21:45
professional dan!sh 6-Dec-09 21:45 
GeneralRe: Converting BitArray to string Pin
Joe Rozario6-Dec-09 21:55
Joe Rozario6-Dec-09 21:55 
AnswerRe: Converting BitArray to string Pin
shiplu_20506-Dec-09 22:27
shiplu_20506-Dec-09 22:27 
GeneralRe: Converting BitArray to string Pin
Joe Rozario6-Dec-09 22:32
Joe Rozario6-Dec-09 22:32 
AnswerRe: Converting BitArray to string Pin
OriginalGriff6-Dec-09 23:17
mveOriginalGriff6-Dec-09 23:17 
AnswerRe: Converting BitArray to string Pin
Luc Pattyn7-Dec-09 0:36
sitebuilderLuc Pattyn7-Dec-09 0:36 
Hi,

this is not related to character set encodings at all, it is either simple arithmetic, or using the appropriate conversion operations.

if you're sure the string is limited to 16 (or 32 or 64) binary digits, you can use code similar to this:
ushort sh=Convert.ToUInt16(binaryString, 2);
byte hi=(byte)(sh>>8);
byte lo=(byte)sh;


The inverse operation would be:
ushort sh=(ushort)((hi<<8) + lo);
binaryString=Convert.ToString(sh, 2);  // won't have leading zeroes
binaryString=binaryString.PadLeft(16, '0');


BTW: you would need a try-catch block to defend against invalid string input.

Smile | :)

Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


GeneralRe: Converting BitArray to string Pin
Joe Rozario7-Dec-09 7:27
Joe Rozario7-Dec-09 7:27 
QuestionCPU Load of a MDI-Child Pin
DrNokill6-Dec-09 19:39
DrNokill6-Dec-09 19:39 
QuestionCustomize Quick Access Toolbar for MS Office 2007 applications Pin
Dumb Programmer6-Dec-09 18:34
Dumb Programmer6-Dec-09 18:34 
Questioncrawling a data of a website Pin
uglyeyes6-Dec-09 14:35
uglyeyes6-Dec-09 14:35 
AnswerRe: crawling a data of a website Pin
Mycroft Holmes6-Dec-09 18:48
professionalMycroft Holmes6-Dec-09 18:48 
QuestionBuiltin function for getting all ip addresses? Pin
Jacob Dixon6-Dec-09 14:23
Jacob Dixon6-Dec-09 14:23 
AnswerRe: Builtin function for getting all ip addresses? Pin
Dave Kreskowiak6-Dec-09 15:46
mveDave Kreskowiak6-Dec-09 15:46 
AnswerRe: Builtin function for getting all ip addresses? Pin
Jacob Dixon6-Dec-09 16:59
Jacob Dixon6-Dec-09 16:59 
GeneralRe: Builtin function for getting all ip addresses? Pin
Mycroft Holmes6-Dec-09 18:50
professionalMycroft Holmes6-Dec-09 18:50 
Questionget file name (only) Pin
tamir9016-Dec-09 10:22
tamir9016-Dec-09 10:22 
AnswerRe: get file name (only) Pin
Blue_Boy6-Dec-09 10:29
Blue_Boy6-Dec-09 10:29 
AnswerRe: get file name (only) Pin
PIEBALDconsult6-Dec-09 17:36
mvePIEBALDconsult6-Dec-09 17:36 
GeneralRe: get file name (only) Pin
tamir9016-Dec-09 20:49
tamir9016-Dec-09 20:49 
Question"View Code" Dropdown Pin
bailout006-Dec-09 8:11
bailout006-Dec-09 8:11 
AnswerRe: "View Code" Dropdown Pin
Saksida Bojan6-Dec-09 8:14
Saksida Bojan6-Dec-09 8:14 
GeneralRe: "View Code" Dropdown Pin
bailout006-Dec-09 9:03
bailout006-Dec-09 9:03 
GeneralRe: "View Code" Dropdown Pin
bailout006-Dec-09 9:11
bailout006-Dec-09 9:11 

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.