我有这个功能
private ulong Html(ubyte[] data)
{
return data.length;
}
我想通过使用toDelegate()
函数转换为委托。我试过了:
client.onReceive = toDelegate(&Html);
但我收到一条错误消息:
lixo.d(722): Error: not a property client.onReceive
/home/$/D/libs/arsd/dom.d(743): Warning: statement is not reachable
/usr/include/d/dmd/phobos/std/range.d(595): Error: static assert "Cannot put a dchar[] into a Appender!(char[])"
/usr/include/d/dmd/phobos/std/format.d(1758): instantiated from here: put!(Appender!(char[]),dchar[])
/usr/include/d/dmd/phobos/std/format.d(1514): instantiated from here: formatRange!(Appender!(char[]),dchar[],char)
/usr/include/d/dmd/phobos/std/conv.d(101): instantiated from here: formatValue!(Appender!(char[]),dchar[],char)
/usr/include/d/dmd/phobos/std/conv.d(757): ... (1 instantiations, -v to show) ...
/usr/include/d/dmd/phobos/std/conv.d(244): instantiated from here: toImpl!(char[],dchar[])
/home/$/libs/arsd/dom.d(2115): instantiated from here: to!(dchar[])
如何解决这个问题?