zoukankan      html  css  js  c++  java
  • 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;
            }
        }
    }
  • 相关阅读:
    初始化项目结构
    Django基础2
    Django基础
    Linux(9~)
    Linux(8~)
    redis案例
    Jedis连接池
    Jedis入门
    redis持久化
    redis命令操作
  • 原文地址:https://www.cnblogs.com/suanshun/p/7001670.html
Copyright © 2011-2022 走看看