5. Given the line $y=-x+4$ intersects the $x$-axis and $y$-axis at points $A$ and $B$ respectively, and intersects the graph of the inverse proportion function $y=\frac{k}{x} (k>0)$ at points $C$ and $D$. If $AB=\sqrt{2} CD$, then the value of $k$ is ( ).
(A) 1
(B) $\sqrt{2}$
(C) 2
(D) $2 \sqrt{2}$
5. C.

As shown in Figure 5, let the line $y=x$ intersect with $y=-x+4$ at point $M$. Then $M(2,2)$. Draw perpendiculars from points $C$ and $M$ to the $x$-axis, with the feet of the perpendiculars being $E$ and $F$ respectively.
Let $C\left(x_{0}, y_{0}\right)$.
By symmetry, we have
$$
\begin{array}{l}
A M=\sqrt{2} M C \Rightarrow \frac{C E}{M F}=\frac{A C}{A M}=\frac{2-\sqrt{2}}{2} \\
\Rightarrow C E=2-\sqrt{2} \\
\Rightarrow y_{0}=2-\sqrt{2}, x_{0}=2+\sqrt{2} \\
\Rightarrow k=x_{0} y_{0}=2 .
\end{array}
$$