N
N
noytmant2020-02-29 16:40:27
C++ / C#
noytmant, 2020-02-29 16:40:27

How to convert string to byte[]?

Here is the code:

string ss = "Da";
var ssinstring = Encoding.UTF8.GetString(ss);

In brackets on ss gives an error - Cannot convert string to byte[]
How to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LiptonOlolo, 2020-02-29
@noytmant

The problem is that you are doing the opposite.
You are trying to convert byte[] to string.
Decision:

string ss = "Da";
var ssinstring = Encoding.UTF8.GetBytes(ss);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question