The C sharp basic knowledge about
2009-02-24 12:02
162 查看
*声明和使用变量 ------------------------- const double PAI = 3.141592;//定义圆周率 ------------------------- int x, y ; int z=0; ------------------------- class test //类 --可自定义 { private int x; //定义局部变量 局部变量不能被类外部程序引用 public int x; //定义全局变量 } test test1 = new test();// 初始化test类 test1为上test的类型 // 引用时可以直接使用,例如 test1.x 为test类中x的值 ------------------------- *字符串运算符 ------------------------- [ ] 索引 从0 开始 ------------------------- staring str1 = "hello"; str1+str2; //+连接字符串 ------------------------- string[] strArray ={"this","is","test"}; strArray[0]; //输出数组中的第一个值 this strArray[2]; //输出数组中的第三个值 test ------------------------- * 赋值运算符 ------------------------- int x =10; string str ="字符"; StringBuilder str1 = new StringBuilder();// 类赋值 int[] arr = {1,2,3,4} ;// 数组赋值 x+ =arr[1]; ------------------------- * 逻辑运算符 ------------------------- && 与 // if ( x== 5 && y = 5 ) || 或 // if ( x == 50 || y = 50 ) ! 非 // if ( !(y == 5) ) ------------------------- * 流程控制 ------------------------- if 语句 if (条件) { } else { } ------------------------- 判断多个条件 if () {} esle if() {} else if() {} else {} ------------------------- switch 分支 switch (条件) //当下面的条件与值相等,即执行相应case { case 值: ..... break; case 值: break; default: ..... break; } ------------------------- while(条件) { ....... } ------------------------- for(int i=10;i>3;i--) { Console.WriteLine("当前变量值为:{0}",i); } ------------------------- break / continue 控制循环 break 跳出循环体 continue 跳出本次循环 ------------------------- #define 条件编译 #define 定义标识符 #undef 取消定义标识符 #if DEBUG //判断是否已经定义标识符 console.writeline("........"); #endif ------------------------- 命名空间 namespace ConsoleApplivation1 { namesapce myspace { class Class1 { public void test() { Console.WriteLine("a"); } } } } -------------------------- 调用类 static void Main(string[] args) { myspace.Class1 mycls = new ConsoleApplication1.myspace.Class1(); mycls.test(); } -------------------------- -------------------------------------------------------------------------------------- 控件 ContextMenuStrip 右击鼠标弹出快捷菜单 MenuStrip 菜单 StatusStrip 信息提示栏‘状态栏 ToolStrip 工具栏 按钮 ToolStripContainer 容器 用于装载控件
相关文章推荐
- Basic knowledge about binary trees
- nb developer faq - What are the basic things I should know about NetBeans' architecture to get started?
- Basic knowledge about XML
- Basic knowledge about binary trees
- Some basic knowledges about the class Object (1)
- Beneficiation Knowledge about the Ore Grades
- [Basic] The most basic things about java
- Basic knowledge about binary trees
- Beginning Linux Programming----Knowledge about compiling the C files in Linux
- Basic knowledge about binary trees
- The basic knowledge of deep learning
- basic knowledge about sql injection
- Basic knowledge about binary trees
- Basic knowledge about binary trees
- ApacheDS 2.0__Basic User Guide 1.5. - About the sample configurations and sample directory data
- torque脚本编程快速入门(ticle about the Torque Scirpt Basic)
- Basic knowledge about binary trees
- The basic concept about process and thread
- Knowledge about the Mill Lubrication Maintenance
- The Minimum About Unicode and Character Sets