s*****w 发帖数: 1527 | 1 hi, i have a char array like this,
char array[0]='a', array[1]='b', array[2]='c';
string myStr = array.ToString();
myStr is not "abc", why ? | h*******s 发帖数: 8454 | 2 不懂c#不过可以考虑把array[3]弄成\0试试看?
【在 s*****w 的大作中提到】 : hi, i have a char array like this, : char array[0]='a', array[1]='b', array[2]='c'; : string myStr = array.ToString(); : myStr is not "abc", why ?
| c**t 发帖数: 2744 | 3 you need implement ToString()
【在 s*****w 的大作中提到】 : hi, i have a char array like this, : char array[0]='a', array[1]='b', array[2]='c'; : string myStr = array.ToString(); : myStr is not "abc", why ?
| s*****w 发帖数: 1527 | 4 hmmmm, never know that ...
【在 c**t 的大作中提到】 : you need implement ToString()
| j*****u 发帖数: 1133 | 5 use the string ctor that takes char array as param:
http://msdn.microsoft.com/en-us/library/ttyxaek9(v=VS.90).aspx
【在 s*****w 的大作中提到】 : hi, i have a char array like this, : char array[0]='a', array[1]='b', array[2]='c'; : string myStr = array.ToString(); : myStr is not "abc", why ?
| s*****w 发帖数: 1527 | 6 did that, but still don't like it.
in my case, i need to
1. left shift the string
2. put the new char in the right most string position
e.g.
"i love my family" => "i love my family."
so what's the best way ?
【在 j*****u 的大作中提到】 : use the string ctor that takes char array as param: : http://msdn.microsoft.com/en-us/library/ttyxaek9(v=VS.90).aspx
| s***o 发帖数: 2191 | 7 do you have to use Array?
With a derived List type, you can override the ToString() method and
output whatever you like.
【在 s*****w 的大作中提到】 : did that, but still don't like it. : in my case, i need to : 1. left shift the string : 2. put the new char in the right most string position : e.g. : "i love my family" => "i love my family." : so what's the best way ?
|
|