开发者

Why does UdpClient.Receive require a ref parameter?

Why is the parameter on UpdClient.Receive a ref parameter, instead of simply out?

According to the MSDN page, the parameter is filled with the address 开发者_如何学Cthat the datagram was sent from. However it doesn't specify what kind of input it is used for, only output.


This looks like one of those (remarkably rare) BCL inconsistencies/discrepancies. This parameter is not used as input in the method at all (as shown by Reflector).

Perhaps this was not always the case and they kept using ref instead of switching to out to preserve backwards compatibility.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜