2. In the Cartesian coordinate system, point $A$ is in the first quadrant, point $B$ is in the second quadrant, and point $C$ is on the coordinate axis, satisfying that $\triangle A B C$ is a right triangle. The maximum number of points $C$ is $a$, and the minimum number of points $C$ is $b$. The value of $a+b$ is ( )
(A)8
(B) 10
(C) 11
(D) 12
2.D.

Since point $A$ is in the first quadrant and point $B$ is in the second quadrant, the perpendicular lines through $A$ and $B$ to $AB$ must intersect the $x$-axis at two points, and intersect the $y$-axis at most at two points, and at least at 0 points; the circle with $AB$ as its diameter must intersect the $y$-axis at two points, and intersect the $x$-axis at most at two points, and at least at 0 points. As shown in Figure 1 and Figure 2.
'From this, we know $a=8, b=4$. Therefore, $a+b=12$.