【发布时间】:2019-09-12 17:38:16
【问题描述】:
我正在阅读有关 SignalR 的信息,并找到了代码:
public ChannelReader<int> Counter(int count, int delay)
{
var channel = Channel.CreateUnbounded<int>();
// We don't want to await WriteItems, otherwise we'd end up waiting
// for all the items to be written before returning the channel back to
// the client.
_ = WriteItems(channel.Writer, count, delay);
return channel.Reader;
}
下划线是什么意思?是可变的吗?
【问题讨论】:
-
你在哪里找到这个代码?它在 SignalR 的源代码中吗?尽管它似乎是一种丢弃,但它似乎也完全没有必要。您不能将结果值分配给任何变量/丢弃。
-
@Zet 更多说明性的 MSDN 页面的质量......并不理想。他们编写的代码经常忽略他们在其他地方给出的建议。
标签: c# system.threading.channels