I am not sure I understand the reason or benefit to creating a string array
that contains the exact same information as the int array, but if you were
using the int array to hold the ascii values or byte values of characters
that you wanted to create in the string array then you could do something
like this.
string[] sa = new string[ intarray.Length];
for (int x = 0; x < intarray.GetUpperBound(0); x++)
sa[x] = (char)intarray[x]
Or an easier way (if you where using a byte array):
string sa = Encoding.ASCII.GetString(buff, 0, buff.GetUpperBound(0));
I have done something similiar in the past for streaming data from telnet
connections and converting the bytes to characters.
The reverse of this (to a byte array) would be:
bytearray = Encoding.ASCII.GetBytes(sa);
- or -
for (int x = 0; x<=sa.GetUpperBound(0); x++)
{
bytearray[x] = Convert.ToByte(sa[x]);
}
Hope this helps.
Gregory McCallum [MCSD]
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
What about a loop?
string[] sa = new string[ intarray.Length];
int i=0;
foreach( int elem in intarray)
sa[ i++] = elem.ToString();
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Allan Ebdrup" <co****@ofir.com> wrote in message
news:ea**************@TK2MSFTNGP15.phx.gbl... How do I easily convert a int[] to a string[]?
Kind Regards,
Allan Ebdrup