Convert string to byte array in c#. [Resolved]

Posted by Allemahesh under C# on 8/14/2013 | Points: 10 | Views : 1463 | Status : [Member] [MVP] | Replies : 2
Dear Team,

I have a string and I want to convert this string to byte array.

Example:-
String str = "109462010C948B010C948B010C948B0169100010000C948B010C948B010C948B010C948B0130100020000C948B010C948B010C948B010C948B0120";

Now I want to store 2 digits to byte array.
Like byte[] b = new byte[10];
b[0] = 10; //or 0x10
b[1] = 94; // or 0x94
b[2] = 62;
b[3] = 01;
--
--
--
So On ..

Can any one help to solve this?




Responses

Posted by: Satyapriyanayak on: 8/14/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
http://www.dotnetperls.com/convert-string-byte-array

If this post helps you mark it as answer
Thanks

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Robertgalp on: 10/11/2014 [Member] Starter | Points: 25

Up
0
Down
Try this

byte[] bArray = Encoding.UTF8.GetBytes (inputString);

Source: http://net-informations.com/q/faq/stringtobyte.html

Robert

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response