byte[]cipherbytes = Encoding.ASCII.GetString(label6.Text);
System.IO.MemoryStream ms = new System.IO.MemoryStream(cipherbytes);
Asked
Active
Viewed 89 times
-1

Bob Kaufman
- 12,864
- 16
- 78
- 107

Sam7382
- 3
- 2
-
How to store string value in byte? – Sam7382 Mar 24 '16 at 18:11
-
sorry for that nextt time i'll carefull for that... – Sam7382 Mar 24 '16 at 18:41
1 Answers
0
To encode the string with a certain encoding, call Encoding.<YourEncoding>.GetBytes()
on, not GetString()
, this function is for returning a string
given the byte[]
representation of it. A possible Encoding could e.g. be ASCII or UTF8 encoding.
byte[] cipherbytes = System.Text.Encoding.ASCII.GetBytes(label6.Text);
See also: How do I get a consistent byte representation of strings in C# without manually specifying an encoding?, Encoding.ASCII.GetBytes()