0 votes
by (140 points)

Hi,

Currently, I am using the below function to convert strings to a byte array.
I want to convert this function to the Rebex method instead of the C1ZStreamWriter.

var ms = new MemoryStream();
var sw = new C1ZStreamWriter(ms);
var srcData = Encoding.UTF8.GetBytes("Hello Test");
sw.Write(srcData, 0, srcData.Length);
sw.Flush();
var x= ms.ToArray();

Any idea?

Thanks
Brendan

1 Answer

0 votes
by (148k points)

To convert a string to a byte array, this line would be sufficient:

var srcData = Encoding.UTF8.GetBytes("Hello Test");

What's the purpose of C1ZStreamWriter here? Are you trying to compress individual string, or something like that?

...