c# 匿名函数和lamda表达式语法

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace _07匿名函数和lamda表达式语法
{
public delegate void DelTest1();
public delegate string DelTest2();
public delegate string DelTest3(string str);
class Program
{
static void Main(string[] args)
{
//DelTest1 del1 = T1;指向普通的函数
//DelTest1 del2 = delegate() { };匿名函数
//DelTest1 del3 = () => { };lamda表达式 //DelTest2 del1 = T2;
//DelTest2 del2 = delegate() { return null; };
//DelTest2 del3 = () => { return null; }; //DelTest3 del1 = T3;
DelTest3 del2 = delegate(string str) { return null; };
DelTest3 del3 = (str) => { return null; };
DelTest3 del4 = str => null;
} static void T1()
{ } static string T2()
{
return null;
} static string T3(string str)
{
return null;
}
}
}
上一篇:mysql支持IOS的Emoji表情


下一篇:python 中的匿名函数lamda和functools模块