c#基础知识

http://msdn.microsoft.com/zh-cn/library/szasx730(v=vs.80).aspx

基本结构:

switch (action)
{
    case "list":
        Getcontent();
        break;
    case "day":
        gatherDay();
        break;
    case "all":
        gatherALl();
        break;
    default:
        fire();
        break;
}
1  if (!int.TryParse(type, out inttype))
2 {
3       inttype = 0;
4  }
1 stringBuilder sb=new stringBuilder();
2 for(int i=0;i<10;i++;)
3 {
4      sb.append("a"+i.tosrtring());
5 }

数组操作:

 1         // Declare a single-dimensional array 
 2         int[] array1 = new int[5];
 3 
 4         // Declare and set array element values
 5         int[] array2 = new int[] { 1, 3, 5, 7, 9 };
 6 
 7         // Alternative syntax
 8         int[] array3 = { 1, 2, 3, 4, 5, 6 };
 9 
10         // Declare a two dimensional array
11         int[,] multiDimensionalArray1 = new int[2, 3];
12 
13         // Declare and set array element values
14         int[,] multiDimensionalArray2 = { { 1, 2, 3 }, { 4, 5, 6 } };
15 
16         // Declare a jagged array
17         int[][] jaggedArray = new int[6][];
18 
19         // Set the values of the first array in the jagged array structure
20         jaggedArray[0] = new int[4] { 1, 2, 3, 4 };

 

posted @ 2013-09-25 16:24  夜明猪  阅读(132)  评论(0编辑  收藏  举报

现在就做 遇见更好的自己