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.
精彩评论