views:

24

answers:

1

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 that the datagram was sent from. However it doesn't specify what kind of input it is used for, only output.

+2  A: 

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.

Daniel Renshaw
I don't believe keeping the method signature but changing funcionality would preserve any kind of backwards compatibility. So, either they broke compatibility and forgot to fix the signature (highly unlikely), or it was always like that...
Martinho Fernandes