推 chiifan:這個問題我也想問,雖然有自己寫,但效率不知? 219.84.81.23 03/08
int i;
byte[] byteAry = {65, 66, 67};
char[] charAry = new char[3];
for( i=0; i<3; i++ )
charAry[i] = Convert.ToChar( byteAry[i] );
Console.WriteLine( byteAry ); // output : System.byte []
Console.WriteLine( charAry ); // output : ABC
小弟寫了上述程式,有2個問題向大家討教:
Q1 :
for( i=0; i<3; i++ )
charAry[i] = Convert.ToChar( byteAry[i] );
請問有沒有function,直接一次接 byteAry to charAry ??
Q2 :
Console.WriteLine( byteAry ); // output : System.byte []
有沒有function讓其輸出為 ABC ??
謝謝大家。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.138.64.169