NetBlog主题
2017-06-26 23:08
3573
public static void FileCopy(string source,string target){using (FileStream fileRead = new FileStream(source, FileMode.Open, FileAccess.Read)){byte[] bb = new byte[1024 * 1024 * 5];int r= fileRead.Read(bb, 0, bb.Length);using(FileStream fileWrite=new FileSt…
2017-06-04 12:01
3644
using System;namespace 类型转换
{class Program{static void Main(string[] args){try{Student s1 = new Student();Person p = new Person();//Student s2 = (Student)p;//这样父类转子类,虽然不报错,但运行时会出错Student s = p as Student;//这样转,如果成功则有返回值…
2017-05-29 17:28
3451
子类继承父类时构造函数是不会被继承的子类默认调用父类的的无参构造函数,如果父类建了一个有参的则无参的会被冲掉,这时子类会报错报错解决方案有2种第1种方法:在父类建一个无参的构造函数第2种方法:子类调用父类的构造函数如public Student(string s1,string s2):base(s1…
2017-05-24 13:49
5233
2020-02-18 更新
实现一个delegate是很简单的,通过以下3个步骤即可实现一个delegate:
1. 声明一个delegate对象,它应当与你想要传递的方法具有相同的参数和返回值类型。
2. 创建delegate对象,并"将你想要传递的函数作为参数传入"。
3. 在要实现异步调用的地方,通过上一…
2017-05-09 00:00
6007
相关的视频教程 https://www.bilibili.com/video/BV1Sw411R7HXProgram.cs中代码:static class Program{/// summary/// 应用程序的主入口点。/// /summary[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefaul…