随笔分类 - C#/.NET学习
摘要:1、使用命名空间 using System.Diagnostics; 2、打印数据 Debug.WriteLine("app running"); 3、打印的信息在即时窗口中 调试-》窗口-》即时
阅读全文
摘要:1、在ui界面拖一个timer控件到下边,设置属性 TRUE代表可用,定时器溢满时间100ms 2、双击定时器控件,自动在源文件中生成回调函数,在函数中写代码
阅读全文
摘要:一、类 1、内部使用的类,默认的,当前项目访问 internal class Myclass { //Class members } 2、公共类,其他项目也可访问 public class Myclass { //Class members } 3、抽象类,不能实例化,需要子类实现方法 public
阅读全文
摘要:public class Person { // 字段 private string name; private int age; private string sex; // 属性 public string Name { get { return name; } set { sex = valu
阅读全文
摘要:https://www.cnblogs.com/leicao/p/5251090.html 委托是一种存储函数引用的类型,在事件和事件的处理时有重要的用途 通俗的说,委托是一个可以引用方法的类型,当创建一个委托,也就创建一个引用方法的变量,进而就可以调用那个方法,即委托可以调用它所指的方法。 委托的
阅读全文
摘要:只由参数签名(个数,顺序,类型)来区别,返回值不做判断,即两个重载的函数可以返回值不同,也可相同
阅读全文
摘要:ps: 1、传入的参数必须是变量(不能是字符串常量或者const),且必须初始化;在函数声明和调用都要用ref 2、也可用out代替上面的ref,但是out的变量可以不用初始化
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Ch06Ex03 { class Program { static int SumVals(params i
阅读全文
摘要:static void Write() { Console.WriteLine("Text output from function."); } ps:必须声明为static
阅读全文
摘要:foreach循环对数组内容进行只读访问,所以不能改变任何元素的值 string[] friendNames = { "Robert Barwell", "Mike Parry", "Jeremy Beacock" }; foreach(string friendName in friendName
阅读全文
摘要:1、 struct route { public orientation direction; public double distance; } 2、带函数的结构体 struct CustomerName { public string firstName,lastName; public str
阅读全文
摘要:1、一维数组 string[] friendNames = { "Robert Barwell", "Mike Parry", "Jeremy Beacock" }; 2、多维数组 二维数组的定义格式: <baseType>[,]<name>;//2维double[,] 多维数组的定义格式:<bas
阅读全文
摘要:enum orientation:byte { north =1, south =2, east =3, west=4 } 注意:声明在代码的主体之外
阅读全文
摘要:参数可以是 switch 语句中的 参数必须是一个整型或枚举类型,或者是一个 class 类型,其中 class 有一个单一的转换函数将其转换为整型或枚举类型。 所以用string也可以,6666
阅读全文
摘要:1、字符串转double int number; string str="123"; number= Convert.ToDouble(str); 2、大写转小写 string.ToLower 3、使用System命名空间的Convert
阅读全文
摘要:#region Using directives //my code #endregion
阅读全文
摘要:1、 Console.WriteLine("hello world ");//自动换行 2、 Console.Write("hello world ");//不换行 3、 Console.ReadKey(); //等待键入 4、格式输出 int myInteger; string myString;
阅读全文