【发布时间】:2015-01-17 01:27:19
【问题描述】:
我想编写一个方法来完成一些工作并最终返回另一个与原始方法具有相同签名的方法。这个想法是根据前一个字节值顺序处理字节流,而不需要递归。像这样调用它:
MyDelegate executeMethod = handleFirstByte //What form should be MyDelegate?
foreach (Byte myByte in Bytes)
{
executeMethod = executeMethod(myByte); //does stuff on byte and returns the method to handle the following byte
}
要移交我想将它们分配给 Func 委托的方法。但是我遇到了一个问题,这会导致递归声明没有终止......
Func<byte, Func<byte, <Func<byte, etc... >>>
我不知何故迷路了。我怎么能解决这个问题?
【问题讨论】: