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

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
SegmentFault 最新的问题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Attack and Defense Labs
Attack and Defense Labs
F
Full Disclosure
Vercel News
Vercel News
N
News | PayPal Newsroom
The GitHub Blog
The GitHub Blog
H
Hacker News: Front Page
H
Heimdal Security Blog
P
Privacy International News Feed
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cisco Blogs
L
Lohrmann on Cybersecurity
D
Docker
Recent Announcements
Recent Announcements
Security Archives - TechRepublic
Security Archives - TechRepublic
人人都是产品经理
人人都是产品经理
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Proofpoint News Feed
T
Tailwind CSS Blog
C
Check Point Blog
博客园 - 叶小钗
Google Online Security Blog
Google Online Security Blog
Martin Fowler
Martin Fowler
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
S
Secure Thoughts
博客园 - Franky
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
P
Palo Alto Networks Blog
Latest news
Latest news
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
Last Week in AI
Last Week in AI
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
Hacker News: Ask HN
Hacker News: Ask HN
T
Threatpost
T
Tenable Blog
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学

博客园 - 数迹

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

在 C# 中,它是一个关键字,用来实现可变参数列表。

在 C# 中,params 是一个关键字,用于指定一个方法参数在调用时可以传入可变数量的参数。

  • 作用: 它允许你向方法传递逗号分隔的多个同类型参数,或者直接传递一个数组,而不需要显式创建数组。

  • 本质: 被 params 修饰的参数在方法内部其实是一个数组。

  • 示例:

    // 定义方法:这里的 int[] 是数据类型,params 是修饰符
    public static int Sum(params int[] numbers)
    {
        int total = 0;
        foreach (int num in numbers) total += num;
        return total;
    }
    
    // 调用时:可以传入任意数量的参数
    int result1 = Sum(1, 2, 3);       // 传入 3 个
    int result2 = Sum(1, 2, 3, 4, 5); // 传入 5 个
    // 编译器自动把这些参数打包成一个 int[] 数组