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

推荐订阅源

博客园_首页
N
News and Events Feed by Topic
P
Privacy International News Feed
The Hacker News
The Hacker News
Schneier on Security
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
Security Latest
Security Latest
L
LINUX DO - 最新话题
阮一峰的网络日志
阮一峰的网络日志
Cisco Talos Blog
Cisco Talos Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
博客园 - 【当耐特】
博客园 - Franky
P
Privacy & Cybersecurity Law Blog
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
月光博客
月光博客
D
Docker
Webroot Blog
Webroot Blog
The GitHub Blog
The GitHub Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
W
WeLiveSecurity
S
Security Affairs
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Archives - TechRepublic
Security Archives - TechRepublic
Microsoft Azure Blog
Microsoft Azure Blog
C
CERT Recently Published Vulnerability Notes
B
Blog
L
Lohrmann on Cybersecurity
T
Threatpost
量子位
S
Schneier on Security
V
Visual Studio Blog
S
Securelist
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
aimingoo的专栏
aimingoo的专栏
The Register - Security
The Register - Security
I
Intezer
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 聂微东
小众软件
小众软件
罗磊的独立博客
雷峰网
雷峰网
Recorded Future
Recorded Future

博客园 - 数迹

1.winform中App.config配置mssql连接字符串 where关键字 1.params 关键字 1.创建实体类UserInfo 1. UserInfo表的创建 3.SqlCommand组件 2.在DbHelper.cs 中使用连接字符串 事件委托1 多播委托 委托总结:委托提供了 A类的对象 调用 B类对象的同一类方法 的能力。 委托2 文心快码 委托1 sql提示注册表中无 \100\ConfigurationState的解决方法 - 数迹 - 博客园 安装SQL server 提示重新启动计算机失败怎么解决 DataGridView插入指定类型的列 菜单制作过程笔记1 ${pagecontext.request.contextpath}绝对路径理解 eclipse中修改JSP模板中的默认编码 hibernate的ddl-auto属性
委托3--委托声明比较
数迹 · 2026-02-10 · via 博客园 - 数迹
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestConsoleFramwork
{
    internal class Program
    {
        //一、创建委托类
        public delegate int CalHandler(int x, int y);
        //二、创建具体的委托方法
        static int Jia(int x,int y) {
            return x + y;
        }
        static int Jian(int x, int y)
        {
            return x - y;
        }

        static void Main(string[] args)
        {
            //三、在方法内生成为方法的委托对象
            CalHandler JiaHandler = new CalHandler(Jia);
            CalHandler JianHandler = new CalHandler(Jian);
            //四、使用委托对象.Invoke方法执行具体的方法
            int a=JiaHandler.Invoke(3,4);
            int b=JianHandler.Invoke(5,6);
            Console.WriteLine(a);
            Console.WriteLine(b);
            //五、也可以使用,两种效果一样
            int c = JiaHandler(3,4);
            int d=JianHandler.Invoke(5,6);
            Console.WriteLine(c);
            Console.WriteLine(d);
            Console.Read();

            //给委托赋值
            CalHandler JiaHandler3 = Jia;
            CalHandler JianHandler4 = Jian;
            Console.WriteLine(JiaHandler3(3, 4));
            Console.WriteLine(JianHandler4(3, 4));
            Console.WriteLine("aaaa");
            Console.Read();
        }
    }
}

posted on 2026-02-10 20:44  数迹  阅读(4)  评论()    收藏  举报