![](/Images/OutliningIndicators/ContractedBlock.gif)
Code
using System;
public class CharTest
{
public static void Main(string[] args)
{
char myChar = 'C';
Console.WriteLine("用字符赋值: " + myChar);
myChar = '\x0057';
Console.WriteLine("用16进制数赋值: " + myChar);
myChar = '\u0070';
Console.WriteLine("用Unicode字符赋值: " + myChar);
myChar = '\a';//响铃转义字符
Console.WriteLine("用Unicode字符赋值.响铃: " + myChar);
myChar = Convert.ToChar(57);
Console.WriteLine("用转换方式赋值: " + myChar);
//字符串变为字符数组
string str = "abcdef";
char[] chararr = str.ToCharArray();
Console.WriteLine(chararr.Length + "," + chararr[3]);
Console.ReadLine();
}
}
posted @
2009-01-13 11:06
jianlinglo
阅读(
121)
评论()
编辑
收藏
举报