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

深入c# Func委托的詳解

 更新時(shí)間:2013年06月09日 09:45:20   作者:  
本篇文章是對(duì)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)文章

最新評(píng)論

苍梧县| 大渡口区| 武义县| 泽州县| 曲周县| 东辽县| 和静县| 仙桃市| 中山市| 松潘县| 望江县| 阿坝| 昭平县| 新沂市| 武定县| 商南县| 皮山县| 兰西县| 都安| 阿勒泰市| 大新县| 织金县| 沭阳县| 锡林浩特市| 株洲市| 故城县| 长乐市| 衡水市| 乐亭县| 成武县| 江阴市| 锡林郭勒盟| 正镶白旗| 和静县| 高邑县| 静乐县| 伊金霍洛旗| 尼玛县| 溆浦县| 昭觉县| 衡南县|