NET岛

导航

数据类型


整型
System.Byte        Byte          8位   无符号                  0  ~  255
System.Int16       Short       16       有                -32768  ~  32767
System.Int32       Int            32      有                      -231  ~  231-1
System.Int64       Long        64      有                     -263   ~  263-1
System.SByte      sbyte         8       有                    -128  ~  27
System.Uint16     ushort      16       无                         0  ~  65535
System.Uint32     Uint         32       无                         0  ~  232-1
System.Uint64     Ulong       64       无                        0  ~  264-1

浮点类型
                                C#          精确度  
System.Single           float           32           7    
System.Double      double          64           15-16     
System.Decimal   decimal         128           28        

其他
System.Boolean
    bool : true,false
System.Char
    char myChar; 
    myChar = "W"c;
    myChar = 'W';
    myChar = '\u01fe';
System.String
System.Object
   
显式类型转换
aShort = (short)anInteger;

通用方法
Equals 判断两个实例是否相等
GetHashCode 作为哈希函数
GetType 返回类型对象
Parse 用于从字符串创建数值

装箱
值类型到引用类型的隐式转换

字符串功能
String.Insert
String.PadLeft,String.PadRight
String.Remove
String.Replace
String.Split
String.Substring
String.ToCharArray
String.ToLower,String.ToUpper
String.TrimEnd,String.TrimStart,String.Trim

String.Compare
String.Concat
String.Format
String.Join 作为指定字符串数组的连接结果的字符串

常量
public const int i = 0;

枚举
public enum DaysOfWeek  //可在此处定义类型  :byte :short :int :long   默认int
{
     Monday = 1,  //可不指定值,默认从0开始指派
     Tuesday = 2,
     Wednesday = 3,
     Thursday = 4,
     Friday = 5,
     Saturday = 6,
     Sunday = 7
}

数组
int[] myInt =  new int[32];
当创建一个引用类型数组时,声明和初始化一个数组时不会对成员填充对象实例,只是创建一个能够指向那个类型的空引用的数组。
int[,] intArrays = new int[5,3]

string[][] families = new string[3][];
families[0] = new string[]{"a","b","c"}
families[1] = new string[]{"a"}

posted on 2005-08-18 23:02  左佩玉  阅读(363)  评论(0编辑  收藏  举报