5. Given the function $f(x)=\frac{\left(2^{x}+1\right)^{2}}{2^{x} x}+1$ on the interval $[-2018,0) \cup(0,2018]$, the maximum value is $M$ and the minimum value is $N$. Then $M+N=(\quad)$.
(A) 3
(B) 2
(C) 1
(D) 0
5. B.

It is known that the graph of $f(x)$ is symmetric about the point $(0,1)$. Therefore, $M+N=f(x)_{\max }+f(x)_{\min }=2$.