摘要: public class Person { // 字段 private string name; private int age; private string sex; // 属性 public string Name { get { return name; } set { sex = valu 阅读全文
posted @ 2018-05-15 19:34 朱小勇 阅读(112) 评论(0) 推荐(0)
摘要: https://www.cnblogs.com/leicao/p/5251090.html 委托是一种存储函数引用的类型,在事件和事件的处理时有重要的用途 通俗的说,委托是一个可以引用方法的类型,当创建一个委托,也就创建一个引用方法的变量,进而就可以调用那个方法,即委托可以调用它所指的方法。 委托的 阅读全文
posted @ 2018-05-15 19:26 朱小勇 阅读(136) 评论(0) 推荐(0)
摘要: 只由参数签名(个数,顺序,类型)来区别,返回值不做判断,即两个重载的函数可以返回值不同,也可相同 阅读全文
posted @ 2018-05-15 19:14 朱小勇 阅读(140) 评论(0) 推荐(0)
摘要: ps: 1、传入的参数必须是变量(不能是字符串常量或者const),且必须初始化;在函数声明和调用都要用ref 2、也可用out代替上面的ref,但是out的变量可以不用初始化 阅读全文
posted @ 2018-05-15 18:58 朱小勇 阅读(91) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Ch06Ex03 { class Program { static int SumVals(params i 阅读全文
posted @ 2018-05-15 18:53 朱小勇 阅读(369) 评论(0) 推荐(0)
摘要: static void Write() { Console.WriteLine("Text output from function."); } ps:必须声明为static 阅读全文
posted @ 2018-05-15 18:46 朱小勇 阅读(91) 评论(0) 推荐(0)
摘要: foreach循环对数组内容进行只读访问,所以不能改变任何元素的值 string[] friendNames = { "Robert Barwell", "Mike Parry", "Jeremy Beacock" }; foreach(string friendName in friendName 阅读全文
posted @ 2018-05-15 18:38 朱小勇 阅读(106) 评论(0) 推荐(0)
摘要: 1、 struct route { public orientation direction; public double distance; } 2、带函数的结构体 struct CustomerName { public string firstName,lastName; public str 阅读全文
posted @ 2018-05-15 18:35 朱小勇 阅读(118) 评论(0) 推荐(0)
摘要: 1、一维数组 string[] friendNames = { "Robert Barwell", "Mike Parry", "Jeremy Beacock" }; 2、多维数组 二维数组的定义格式: <baseType>[,]<name>;//2维double[,] 多维数组的定义格式:<bas 阅读全文
posted @ 2018-05-15 18:35 朱小勇 阅读(163) 评论(0) 推荐(0)
摘要: enum orientation:byte { north =1, south =2, east =3, west=4 } 注意:声明在代码的主体之外 阅读全文
posted @ 2018-05-15 18:28 朱小勇 阅读(386) 评论(0) 推荐(0)
摘要: 参数可以是 switch 语句中的 参数必须是一个整型或枚举类型,或者是一个 class 类型,其中 class 有一个单一的转换函数将其转换为整型或枚举类型。 所以用string也可以,6666 阅读全文
posted @ 2018-05-15 18:14 朱小勇 阅读(191) 评论(0) 推荐(0)
摘要: 1、字符串转double int number; string str="123"; number= Convert.ToDouble(str); 2、大写转小写 string.ToLower 3、使用System命名空间的Convert 阅读全文
posted @ 2018-05-15 17:49 朱小勇 阅读(275) 评论(0) 推荐(0)
摘要: #region Using directives //my code #endregion 阅读全文
posted @ 2018-05-15 17:35 朱小勇 阅读(237) 评论(0) 推荐(0)
摘要: 1、 Console.WriteLine("hello world ");//自动换行 2、 Console.Write("hello world ");//不换行 3、 Console.ReadKey(); //等待键入 4、格式输出 int myInteger; string myString; 阅读全文
posted @ 2018-05-15 17:31 朱小勇 阅读(278) 评论(0) 推荐(0)