Click here to Skip to main content
15,905,316 members
Home / Discussions / C#
   

C#

 
GeneralRe: byte[] cast to a string Pin
Jörgen Sigvardsson30-Oct-03 9:41
Jörgen Sigvardsson30-Oct-03 9:41 
GeneralRe: byte[] cast to a string Pin
Tym!30-Oct-03 10:48
Tym!30-Oct-03 10:48 
GeneralRe: byte[] cast to a string Pin
Jörgen Sigvardsson30-Oct-03 11:20
Jörgen Sigvardsson30-Oct-03 11:20 
GeneralRe: byte[] cast to a string Pin
Tym!30-Oct-03 12:28
Tym!30-Oct-03 12:28 
GeneralRe: byte[] cast to a string Pin
Jörgen Sigvardsson30-Oct-03 12:32
Jörgen Sigvardsson30-Oct-03 12:32 
GeneralRe: byte[] cast to a string Pin
Tym!30-Oct-03 12:41
Tym!30-Oct-03 12:41 
GeneralRe: byte[] cast to a string Pin
Jörgen Sigvardsson30-Oct-03 12:45
Jörgen Sigvardsson30-Oct-03 12:45 
GeneralRe: byte[] cast to a string Pin
Blake Coverett30-Oct-03 11:35
Blake Coverett30-Oct-03 11:35 
While it is counter-intuitive, what you want in this case is UnicodeEncoding.GetString(byte[]). Because the data inside a string is natively stored using that UnicodeEncoding, it is a null transform, leaving your bytes alone.

(I suspect you'd better have an even number of bytes in your array if you want this to work. Herein lies a subtle inconsistency between BSTR's and System.Strings. BSTR's kind of admit to being used to pass random data around, and hence support odd numbers of bytes even though they are supposedly a strings of 16bit values. Your API hopefully won't care if you pad an extra null on the end if the length was odd.)

-Blake
GeneralRe: byte[] cast to a string Pin
Tym!30-Oct-03 12:33
Tym!30-Oct-03 12:33 
GeneralRe: byte[] cast to a string Pin
Jeff Varszegi30-Oct-03 13:11
professionalJeff Varszegi30-Oct-03 13:11 
GeneralRe: byte[] cast to a string Pin
leppie30-Oct-03 14:29
leppie30-Oct-03 14:29 
GeneralRe: byte[] cast to a string Pin
Tym!3-Nov-03 6:30
Tym!3-Nov-03 6:30 
Generalput codes into an event! Pin
Silly Boy30-Oct-03 6:19
Silly Boy30-Oct-03 6:19 
GeneralRe: put codes into an event! Pin
Heath Stewart30-Oct-03 9:09
protectorHeath Stewart30-Oct-03 9:09 
GeneralRe: put codes into an event! Pin
Judah Gabriel Himango30-Oct-03 9:12
sponsorJudah Gabriel Himango30-Oct-03 9:12 
GeneralRe: put codes into an event! Pin
Heath Stewart30-Oct-03 9:25
protectorHeath Stewart30-Oct-03 9:25 
GeneralRe: put codes into an event! Pin
Nick Parker30-Oct-03 13:28
protectorNick Parker30-Oct-03 13:28 
GeneralMoving a control Pin
mcgahanfl30-Oct-03 5:46
mcgahanfl30-Oct-03 5:46 
GeneralRe: Moving a control Pin
Mike Ellison30-Oct-03 6:21
Mike Ellison30-Oct-03 6:21 
GeneralRe: Moving a control Pin
mcgahanfl30-Oct-03 6:54
mcgahanfl30-Oct-03 6:54 
Generalpassing the datatable as a parameter 2 the SP Pin
venubabu30-Oct-03 3:26
venubabu30-Oct-03 3:26 
GeneralRe: passing the datatable as a parameter 2 the SP Pin
Paul Watson30-Oct-03 3:54
sitebuilderPaul Watson30-Oct-03 3:54 
GeneralLaunch a programm from an application Pin
Matthieu.C29-Oct-03 22:31
Matthieu.C29-Oct-03 22:31 
GeneralRe: Launch a programm from an application Pin
Corinna John30-Oct-03 2:37
Corinna John30-Oct-03 2:37 
QuestionRichTextBox?? Pin
electronicm29-Oct-03 21:38
electronicm29-Oct-03 21:38 

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.