English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I alreay did using loop as below

for ( int i =0; i< mybytearray.Length ; i++)
message = message + (char)mybytearray[i];
in which mybytearray is byte array
and message is string;
but dut to this spead is slows down.

plz help me.

2006-07-16 18:26:15 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

Try The following Code:
byte [] arrBytes = new byte[10];
System.Text.Encoding.ASCII.GetString(arrBytes);

Also you can visit the Link:
http://geekswithblogs.net/timh/archive/2005/06/27/44849.aspx

I hope this solves your Problem and is Good enough for being the Best Answer ;)

2006-07-16 18:58:35 · answer #1 · answered by ♥HotIce♥ 3 · 1 0

Will this help

' VB.NET to convert a string to a byte array
Public Shared Function StrToByteArray(str As String) As Byte()
Dim encoding As New System.Text.ASCIIEncoding()
Return encoding.GetBytes(str)
End Function 'StrToByteArray

// C# to convert a string to a byte array.
public static byte[] StrToByteArray(string str)
{
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);
}

' VB.NET to convert a byte array to a string:
Dim dBytes As Byte() = ...
Dim str As String
Dim enc As New System.Text.ASCIIEncoding()
str = enc.GetString(dBytes)

// C# to convert a byte array to a string.
byte [] dBytes = ...
string str;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
str = enc.GetString(dBytes);

2006-07-16 22:08:16 · answer #2 · answered by Joe_Young 6 · 0 0

int num1= n1[0]; This line is trying to assign an array element from an int that is not declared as an array.

2016-03-16 00:51:00 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers