怎样在手机上建网站,wordpress链接提交百度,企业门户网站制作教程,物联网专业就业方向C#参数使用场景简要说明
1、传值参数 方法、类成员的初始化 2、输出参数 方法返回值不能满足#xff0c;需要多个返回值时#xff1b; 3、引用参数 方法需要修改变量需带回原变量时#xff1b; 4、具名参数 代码可读性高#xff0c;参数可交换位置 5、方法扩展#xff08…C#参数使用场景简要说明
1、传值参数 方法、类成员的初始化 2、输出参数 方法返回值不能满足需要多个返回值时 3、引用参数 方法需要修改变量需带回原变量时 4、具名参数 代码可读性高参数可交换位置 5、方法扩展this参数 方法扩展时目前不存在满足的方法 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
//this参数扩展方法
namespace PamametersExample9
{class Program{static void Main(string[] args){Listint vs new Listint() { 11, 21, 13, 1, 15 };bool b AllCreateThanTen(vs);//lambda表达式bool b1 vs.All(i i 10);Console.WriteLine(b);Console.WriteLine(b1);}static bool AllCreateThanTen( Listint vs){foreach (var item in vs){if (item 10){return false;}}return true;}}
}
6、可选参数 参数拥有默认值 7、数组参数 简化方法的调用不需要额外声明数组