相关疑难解决方法(0)

.NET2中的Action委托 - 使用泛型类型'System.Action <T>'需要'1'类型参数

我正在将工作代码从.NET4移植到.NET2(WinCE设备).

在.NET2中不允许使用不带参数且不返回任何值的Action

编译错误在第5行:使用泛型类型'System.Action'需要'1'类型参数

解决方法的想法?

//first state is the default for the system
    public enum States { EnterVoucherCode, EnterTotalSale, ProcessVoucher };
    public enum Events { PressNext, PressRedeem, ProcessSuccess, ProcessFail, PressBackToVoucherCode };

    public States State { get; set; }

    private Action[,] fsm; //Fails to compile here

    public FiniteStateMachine()
    {
        //array of action delegates
        fsm = new Action[3, 5] { 
        //PressNext,     PressRedeem,            ProcessSuccess,      ProcessFail,      PressBackToVoucherCode
Run Code Online (Sandbox Code Playgroud)

c# delegates

5
推荐指数
1
解决办法
4411
查看次数

标签 统计

c# ×1

delegates ×1