随笔分类 -  C#

摘要:string str = "af adsf e4afef3 _asdf $adsf"; char[] chr = { ' ', '_', '$' }; //StringSplitOptions.RemoveEmptyEntries去掉空格 ... 阅读全文
posted @ 2015-05-13 22:34 自由无风 阅读(180) 评论(0) 推荐(0)
摘要:public static void Main(string[] args) { Stopwatch sw = new Stopwatch(); //程序计时器 StringBuilder str = new StringBuilder... 阅读全文
posted @ 2015-05-13 22:21 自由无风 阅读(242) 评论(0) 推荐(0)
摘要:string s = "asdf"; //字符转char char[] c = s.ToCharArray(); Console.WriteLine(s[0]); //char转string string s1 =... 阅读全文
posted @ 2015-05-13 22:12 自由无风 阅读(7778) 评论(0) 推荐(0)
摘要:项目右键引用 ,添加要引用的然后在代码用 using 绰用 阅读全文
posted @ 2015-05-13 21:45 自由无风 阅读(1775) 评论(0) 推荐(0)
摘要:public class Students { //创建对像时使用 public Students(string name, int age, char gender, int englist, int chinese, int math) { ... 阅读全文
posted @ 2015-05-13 21:16 自由无风 阅读(1074) 评论(0) 推荐(0)
摘要:作用:帮助我们初始化对像(给对像的每个属性依次的赋值)构造函数是一个特殊的方法1、构造函数没有返回值,连void也不能写2、构造函数名称要和类名一样3、创建对像时会执行构造函数4、构造函数可以重载类中默认有一个构造函数(隐藏的),如果你创建了一个构造函数,不管是有参数的,还是无参数的,他默认的那个无... 阅读全文
posted @ 2015-05-10 22:13 自由无风 阅读(4207) 评论(0) 推荐(1)
摘要:students 类using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ClassLibrary1{ p... 阅读全文
posted @ 2015-05-10 22:00 自由无风 阅读(207) 评论(0) 推荐(0)
摘要:static静态类与非静态类的区别1、在非静态类中可以有实例成员也可以有静态成员2、在调用的时候需要使用对像名.实例成员调用(先要实例化,如person ps=new person(); ps.janzhi;) 在调用静态成员的时候,需要使用类名.静态成员名person.jianzhi() int... 阅读全文
posted @ 2015-05-10 21:17 自由无风 阅读(357) 评论(0) 推荐(0)
摘要:person类using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ClassLibrary1{ clas... 阅读全文
posted @ 2015-05-10 18:20 自由无风 阅读(2182) 评论(0) 推荐(0)
摘要:Preson类using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ClassLibrary1{ clas... 阅读全文
posted @ 2015-05-10 17:14 自由无风 阅读(554) 评论(0) 推荐(0)
摘要:方法的重载参数不同,个数可以相同参数相同,个数不能相同 static void Main(string[] arr) { Console.WriteLine(M(2,3)); Console.ReadKey(); ... 阅读全文
posted @ 2015-05-10 15:59 自由无风 阅读(399) 评论(0) 推荐(0)
摘要:static void Main(string[] arr) { int[] shuZi; bool bj = false; while (!bj) { ... 阅读全文
posted @ 2015-05-10 15:54 自由无风 阅读(304) 评论(0) 推荐(0)
摘要:params将方法中实际参数列表中跟可变参数数组类型一致的类型,都处理为数组中的的元素 static void Main(string[] arr) { // int[] numbers={2,3,4,6,7,5,434,341,412} /... 阅读全文
posted @ 2015-05-09 22:23 自由无风 阅读(7247) 评论(1) 推荐(0)
摘要:ref参数能够将一个变量带入方法进行改变,改变完成后再将改变完成后的变量带出方法ref参数要求在方法外必须为值赋值,而方法内可以不赋值static void Main(string[] arr) { int gongzi = 5000; Ji... 阅读全文
posted @ 2015-05-09 22:07 自由无风 阅读(532) 评论(0) 推荐(0)
摘要:static void Main(string[] arr) { Console.WriteLine("请输入用户名"); string uname = Console.ReadLine(); ... 阅读全文
posted @ 2015-05-09 21:54 自由无风 阅读(791) 评论(0) 推荐(0)
摘要:static void Main(string[] arr) { int max= Class1.GetMax(4, 7); Console.WriteLine(max); Console.ReadKey();... 阅读全文
posted @ 2015-05-06 22:35 自由无风 阅读(306) 评论(0) 推荐(0)
摘要:static void Main(string[] arr) { int[] names = {4,2,5,7,6,8,9,1,3,0};//Array.Sort(names)数组排序 for (int i = 0; i n... 阅读全文
posted @ 2015-05-06 22:10 自由无风 阅读(198) 评论(0) 推荐(0)
摘要:static void Main(string[] arr) { string[] names = { "老杨1", "老李2", "老王3", "老牛4", "老虎5", "老磁6" }; for (int i = 0; i < names... 阅读全文
posted @ 2015-05-06 21:57 自由无风 阅读(3794) 评论(0) 推荐(0)
摘要://计算数组中最大值,最小值,平均值和总和 //类中main最先执行 static void Main(string[] args) { //声明一个数组,数组长度一定固定就不能更改了 int[] nums = {... 阅读全文
posted @ 2015-05-06 21:44 自由无风 阅读(1660) 评论(0) 推荐(0)
摘要:元数据相对我们来说通俗点 就是你引用里面引用的那些dll比如 对Thread 按F12不就是提示从元数据,.. 阅读全文
posted @ 2015-05-06 21:32 自由无风 阅读(3147) 评论(0) 推荐(0)