C# _u=WriteItems(channel.Writer、count、delay)中下划线的含义是什么;
我正在阅读有关Signal的信息,我发现了以下代码:C# _u=WriteItems(channel.Writer、count、delay)中下划线的含义是什么;,c#,system.threading.channels,C#,System.threading.channels,我正在阅读有关Signal的信息,我发现了以下代码: 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
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;
}
公共通道读取器计数器(整数计数、整数延迟)
{
var channel=channel.CreateUnbounded();
//我们不想等待书面通知,否则我们最终会等待
//返回频道之前要写入的所有项目
//客户。
_=WriteItems(channel.Writer、count、delay);
返回通道。读卡器;
}
下划线是什么意思?它是可变的吗?我可能错了,但在我看来它像是一个变量。您在哪里找到此代码的?它在信号器的源代码中吗?虽然这似乎是一个放弃,但它也似乎完全没有必要。您不能将结果值分配给任何变量/放弃。@mason@Zet更具说明性的MSDN页面的质量……不理想。他们通常编写的代码忽略了他们在其他地方给出的建议。