摘要: 从宏观的角度来看,对象是类的实例。比如: //定义一个名为Someone的类,代表这么一些人(通过指定年龄,性别,性格等基本信息)class Someone { public int age; public string sex; public string name; //other...}//. 阅读全文
posted @ 2019-04-16 17:42 Sky丨芒果 阅读(5470) 评论(0) 推荐(1) 编辑
摘要: ref关键字用于将方法内的变量改变后带出方法外。具体我们通过例子来说明: static void Main(string[] args) { int c = 0; Add(1, 2,ref c); Console.WriteLine(c); } static void Add(int a, int 阅读全文
posted @ 2019-04-16 17:08 Sky丨芒果 阅读(9389) 评论(0) 推荐(1) 编辑
摘要: 在C#中,我们可以非常自由的、毫无限制的访问公有字段, 但在一些场合中,我们可能希望限制只能给字段赋于某个范围的值、或是要求字段只能读或只能写, 或是在改变字段时能改变对象的其他一些状态,这些单靠字段是无法做到的,于是就有了属性, 属性中包含两个块:set和get,set块负责属性的写入工作,get 阅读全文
posted @ 2019-04-16 16:40 Sky丨芒果 阅读(1211) 评论(0) 推荐(1) 编辑
摘要: /// <summary> /// 将字符串转成二进制 /// </summary> /// <param name="s"></param> /// <returns></returns> public static string bianma(string s) { byte[] data = 阅读全文
posted @ 2019-04-16 16:09 Sky丨芒果 阅读(7197) 评论(0) 推荐(0) 编辑