Say I have a class and it contructor is public Protocol(Object port) and I would only allow user to pass in the System.IO.Ports.SerialPort or System.Net.Sockets.TcpClient only, other object types will consider error. How can I achieve this enforcement?
Please help!