Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

string to binary[]

Tags:

c#

stream

I have a string I need to feed to a com object that has a LoadFromStream method accepting "object Data". I'm guessing this should be a byte[].

Rather basic question: I got my MemoryStream all filled and ready to go. What's the best way to convert it to binary[]? Should I manually read it into the array one by one or is there an easy built in way?

like image 485
Boris Callens Avatar asked May 12 '26 10:05

Boris Callens


1 Answers

MemoryStream has a ToArray() method which returns a byte[].

like image 62
Will Dean Avatar answered May 14 '26 23:05

Will Dean



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!