惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
S
Security @ Cisco Blogs
S
Secure Thoughts
Attack and Defense Labs
Attack and Defense Labs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hacker News: Front Page
博客园 - 叶小钗
H
Heimdal Security Blog
Microsoft Security Blog
Microsoft Security Blog
Forbes - Security
Forbes - Security
AI
AI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Troy Hunt's Blog
罗磊的独立博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
爱范儿
爱范儿
GbyAI
GbyAI
The Last Watchdog
The Last Watchdog
TaoSecurity Blog
TaoSecurity Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
D
DataBreaches.Net
Recent Announcements
Recent Announcements
Schneier on Security
Schneier on Security
C
Cisco Blogs
美团技术团队
D
Docker
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
月光博客
月光博客
雷峰网
雷峰网
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
Arctic Wolf
B
Blog RSS Feed
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
N
News and Events Feed by Topic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
W
WeLiveSecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
G
GRAHAM CLULEY
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
The Hacker News
The Hacker News

博客园 - 沉默杨

[转]ie6下表格宽度超宽bug,问题的解决方法(兼容ie6,7,8,ff) c#高级编程第六版读书笔记 两列布局右侧自适应ie6bug - 沉默杨 - 博客园 iframe自适应宽度和高度 - 沉默杨 - 博客园 vs2010的bug jquery选择器笔记 Sql Server 2005 row_number()分页性能测试比较 ie6兼容的bug调整 fckeditor提交失败返回内容变html的解决方法 .net环境下ckeditor与ckfinder学习笔记 ckfinder与fckeditor 2.6.5集成 seo.你的网站犯了多少错? 程序员必不可少的firefox插件推荐 SEO专题之七:如何提高PR值 seo专题之六:页面优化 最牛B的英汉翻译,笑傻了ba ... seo专题之五:title,keywords,description标签 SEO专题之四:如何合理有效选定关键字 SEO专题之三:SEO与网站开发
c#高级编程第六版读书笔记二(委托)
沉默杨 · 2010-10-26 · via 博客园 - 沉默杨

委托对我来说一直是似懂非懂.过不久又得翻书重新理解.现将自己的理解以白话文的方式记录下来.

好文地址:http://www.cnblogs.com/JimmyZhang/archive/2007/09/23/903360.html

 1.声明委托.

委托是一个类,它定义了方法的类型,使得可以将方法当作另一个方法的参数来进行传递,这种将方法动态地赋给参数的做法,可以避免在程序中大量使用If-Else(Switch)语句,同时使得程序具有更好的可扩展性。

  理解委托的一种好方式是把委托当作给方法签名和返回类型指定名称,其语法的定义类似于方法的定义,但没有方法体,而且方法与委托的签名必须匹配

  定义

  [访问修改符] delegate [返回类型] deleteagemethod(参数).如

   public delegate void invoke(int parameter)

  使用:

   因为在static main()方法中.所以方法声明为静态

//委托方法
        public static void add(int x)
        {
            x=x+x;
            Console.WriteLine("自加为" + x);
        }
        //委托方法
        public static void multi(int y)
        {
            y = y * y;
            Console.WriteLine("自乘为" + y);
        }
/*委托测试*/
        invoke voke = new invoke(multi);
        //委拖推断写法,为了减少输入量,只需要委托实例,就可以只传送地址的名字,这称为委托推断,只要编译器可以把委托安便解析为特定的类型,这个c#特性就是有效的.如
       //invoke voke=multi;
        voke(4);