1. The number of all integer solutions to the equation $\left(x^{2}+x-1\right)^{x+3}=1$ is ( ).
(A) 5
(B) 4
(C) 3
(D) 2
1. B.

The condition for the original equation to have integer solutions is and only is the following three:
(1) $x+3=0$, and $x^{2}+x-1 \neq 0$, in this case, $x=-3$ is an integer solution of the equation;
(2) $x^{2}+x-1=1$, solving gives $x=-2$ or 1, so the original equation has two integer solutions;
(3) $x^{2}+x-1=-1$, and $x+3$ is even, solving gives $x=0$ or -1, clearly, only when $x=-1$, $x+3=2$ is even, in this case, the original equation has only one integer solution.
In summary, the original equation has a total of 4 solutions.