Authors of a public API should always remember to validate input arguments:

```cs
if (element == null)
    throw new ArgumentNullException("element");
if (portCount <= 0)
    throw new ArgumentException("Argument should be greater than zero", "portCount");
```