Action delegate in .NET2 - Using the generic type 'System.Action' requires '1' type arguments

前端 未结 1 1634
清歌不尽
清歌不尽 2021-01-18 20:49

I\'m porting working code from .NET4 to .NET2 (a WinCE device).

The usage of Action taking no arguments and returning no value isn\'t allowed in .NET2

com

1条回答
  •  无人共我
    2021-01-18 21:29

    Indeed, the non-generic Action was added in .NET 3.5.

    However, Action is just an ordinary delegate type, so you could simply roll your own, like so:

    public delegate void Action();
    

    0 讨论(0)
提交回复
热议问题