随笔分类 - .net
主要为C#技术相关知识及框架知识等
摘要:1 class Program { 2 static void Main(string[] args) { 3 4 } 5 } 6 7 interface IMyInterface { 8 void Method1(); 9 } 10 11 //一、六种类型约束 12 //1、类型参数必须是引用类型
阅读全文
摘要:总结:event关键字的作用,用于不公开发布器中委托对象实例,对事件委托对象进行保护,禁止外部调用。 1、C#事件举例说明 1 //事件及event关键字存在的意义 2 class Program 3 { 4 //事件,发布(publisher)-订阅(subscriber)模型 5 static
阅读全文
摘要:Action和Func是微软已经定义好的的两种委托类型,区别是Action是没有返回值的,而Func是需要返回值的。 1 //Action内置委托的实例化及调用 2 //不带参数 3 Action myAction1 = () => { Console.WriteLine("这是一个Action委托
阅读全文
摘要:1 delegate void NumberCalculator(int a); 2 class Program 3 { 4 static int num1 = 100; 5 static void Main(string[] args) 6 { 7 /*1、委托的多播*/ 8 NumberCalc
阅读全文
摘要:总结:委托使用,归纳有三个过程:1、声明委托;2、实例化委托;3、调用委托。也可以简化使用。 //声明一个委托 delegate int NumberCalculator(int a, int b); class Program { static int num1 = 3; static int n
阅读全文
摘要:using ICSharpCode.SharpZipLib.Zip; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System
阅读全文