public CheonJiInKeyHandler(HancheckFunc hancheck, ShowFunc showFunc, HideFunc hideFunc)
        {
            Hancheck = hancheck;
            Show     = showFunc;
            Hide     = hideFunc;

            InitializeKeyDictionary();
        }
Exemple #2
0
        public override void RunTest()
        {
            OtherClass other = new OtherClass();

            other.SendMsgEvent += this.GetMsg;  //连接other类的SendMsgEvent事件和本类的GetMsg()槽函数
            other.addMsg("other类.addMsg()发出消息,触发SendMsgEvent事件");
            other.addMsg("class类在槽函数GetMsg()收到数据并显示到控件上");
            other.SendMsgEvent -= this.GetMsg;  //断开other类的SendMsgEvent事件和本类的GetMsg()槽函数
            other.addMsg("other类.addMsg()发出消息,无法接收");
            //非匿名函数方法
            ddr($"内联函数add20(5){add20(5)}");
            ddr($"内联函数add20(6){add20(6)}");
            HideFunc hideFunc = delegate(int x)
            {
                return(x + 20);
            };

            ddr($"委托匿名函数hideFunc(5){hideFunc(5)}");
            ddr($"委托匿名函数hideFunc(6){hideFunc(6)}");
            HideFunc lambdaFunc1 = (int x) =>
            {
                return(x + 10);
            };
            HideFunc lambdaFunc2 = (x) =>
            {
                return(x + 10);
            };
            HideFunc lambdaFunc3 = x =>
            {
                return(x + 10);
            };
            HideFunc lambdaFunc4 = x => x + 10;

            ddr($"lambda匿名函数lambdaFunc1(5){lambdaFunc1(5)}");
            ddr($"lambda匿名函数lambdaFunc2(6){lambdaFunc2(6)}");
            ddr($"lambda匿名函数lambdaFunc3(7){lambdaFunc2(7)}");
            ddr($"lambda匿名函数lambdaFunc4(8){lambdaFunc2(8)}");
        }