G
Guest
This code compiles (this is how it should work):
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
This code does not compile (passing an int instead of an AddressFamily is
bad):
Socket sock = new Socket(1, SocketType.Stream, ProtocolType.Tcp);
But why on earth does not compile:
Socket sock = new Socket(0, SocketType.Stream, ProtocolType.Tcp);
Is the number zero some kind of special case here? Why is zero accepted when
the parameter type clearly says that an AddressFamily enum value is expected?!
regards,
martin
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
This code does not compile (passing an int instead of an AddressFamily is
bad):
Socket sock = new Socket(1, SocketType.Stream, ProtocolType.Tcp);
But why on earth does not compile:
Socket sock = new Socket(0, SocketType.Stream, ProtocolType.Tcp);
Is the number zero some kind of special case here? Why is zero accepted when
the parameter type clearly says that an AddressFamily enum value is expected?!
regards,
martin