In the appendix of *Algebaric Geometry* by Hartshorne, he shows us that how Serre defines the *intersection number* in a more general case:$$i(X,Y;Z)=\sum(-1)^i\cdot\bigl(\operatorname{length} \operatorname{Tor}^A_i(A/a,A/b)\bigr),$$

where $X,Y$ intersect properly, $Z$ is an irreducible component, $A$ is the local ring of generic point of $Z$, and $a$ and $b$ are the ideals of $X$ and $Y$ in $A$.
However, when computing a detailed example, such as when $X$ is a projective variety in $\mathbb P^n$ and $Y$ is a complete intersection defined by $f_1,...,f_r$, I find it difficult to write down what the intersection number is.
Sincerely hope for a detailed computing method.