最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

深入c# Func委托的詳解

 更新時(shí)間:2013年06月09日 09:45:20   作者:  
本篇文章是對c#中的Func委托進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
如下所示:
復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Anonymous_Lam
{
    delegate string ConvertMethod(string Method);
    class Lambda_Fun
    {
        static void Main()
        {
            ConvertMethod ConvertUpperstring = upperCaseString;
            Console.WriteLine("Using delegate instance to call upperString method");
            Console.WriteLine(ConvertUpperstring("guohu"));
            Console.WriteLine("--------------------");
            Console.WriteLine("Using anonymous delegate");
            ConvertMethod ConvertAsynCaseString = delegate(string s)
            {
                return s.ToUpper();
            };
            Console.WriteLine(ConvertAsynCaseString("leihu"));
            Console.WriteLine("--------------------");
            Console.WriteLine("Using Func<int T,Out TResult>");
            Func<string, string> FuncCaseUpper = upperCaseString;
            Console.WriteLine(FuncCaseUpper("junwenLi"));
            Console.WriteLine("--------------------");
            Console.WriteLine("Using anonymous Func<int T,Out TResult>");
            Func<string, string> FuncAnonyCaseUpper = delegate(string Name)
            {
                return Name.ToUpper();
            };
            Console.WriteLine(FuncAnonyCaseUpper("jinhaoLiu"));
            Console.WriteLine("--------------------");
            Console.WriteLine("Using lambda Expression");
            Func<string, string> FuncLambda = Name => Name.ToUpper();
            Console.WriteLine(FuncLambda("chengfan"));
        }
        static string upperCaseString(string strName)
        {
            return strName.ToUpper();
        }
    }
}

相關(guān)文章

最新評論

山丹县| 枝江市| 天峨县| 尚志市| 胶州市| 湘阴县| 司法| 北京市| 广丰县| 婺源县| 黎城县| 靖西县| 灵台县| 大化| 仪征市| 福州市| 清苑县| 镇康县| 成安县| 内黄县| 仁化县| 安仁县| 丰都县| 波密县| 葵青区| 海林市| 永宁县| 图片| 四平市| 常州市| 罗田县| 澄迈县| 衡南县| 内乡县| 普宁市| 巩留县| 哈密市| 祁门县| 龙南县| 峨眉山市| 南木林县|