6. All integer solutions to the equation $x^{2}+y^{2}=2(x+y)+x y$ are ( ).
(A) one set
(B) two sets
(C) two sets
(D) four sets
6. (C).

The original equation is rearranged to $x^{2}-(y+2) x+\left(y^{2}-2 y\right)=0$.
$$
\begin{array}{l}
\Delta=(y+2)^{2}-4\left(y^{2}-2 y\right) \geqslant 0, \\
\frac{6-4 \sqrt{3}}{3} \leqslant y \leqslant \frac{6+4 \sqrt{3}}{3} .
\end{array}
$$

Since $y$ is a positive integer, we have $1 \leqslant y \leqslant 4$. Thus, $y=1,2,3,4$. When $y=1$, $x^{2}-3 x-1=0$, which has no positive integer solutions; when $y=2$, $x^{2}-4 x=0$, which has the positive integer solution 4; when $y=3$, $x^{2}-5 x+3=0$, which has no positive integer solutions; when $y=4$, $x^{2}-6 x+8=0$, which has the positive integer solutions 2,4. Therefore, the positive integer solutions to the original equation are