Example 8 If $M=\left\{(x, y)|| \operatorname{tg} \pi y \mid+\sin ^{2} \pi x\right.$ $=0\}, N=\left\{(x, y) \mid x^{2}+y^{2} \leqslant 2\right\}$, then the number of elements in $M \cap N$ is ( ).
(A) 4
(B) 5
(C) 8
(D) 9
(1993, National High School Mathematics Competition)
Solution: From the condition that the sum of non-negative numbers is zero, we get
$$
\left\{\begin{array}{l}
\operatorname{sin} \pi x = 0, \\
\operatorname{tr} \pi y = 0
\end{array} \Rightarrow \left\{\begin{array}{l}
x=l, \dot{k} \in \mathbf{Z}, \\
y=i, l \in \mathbf{Z}.
\end{array}\right.\right.
$$

That is, the set $M$ consists of all integer points on the coordinate plane.
Also, from $x^{2}+y^{2} \leqslant 2$, we know that the set $N$ is the set of points within the closed circle centered at the origin with a radius of $\sqrt{2}$.

By drawing the diagram, it is clear that there are 9 integer points within the closed circle. Therefore, the correct choice is (D).