Let $M$ be a complex $2$-dimensional manifold and $C$ be a compact complex curve in $M$ (possibly singular). Let us suppose that there exists a holomorphic function $f\in\mathcal{O}(M)$ such that
- $f$ is non constant
- $\{f=0\}=C\cup A$, with $A$ a complex analytic set of dimension $1$
- there is no neighborhood $V$ of $C$ and no function $g\in\mathcal{O}(V)$ such that $C=\{g=0\}$.
I would like to conclude that $C\cdot C<0$.
If $C$ is smooth, then $f$ gives me a nontrivial section of the conormal bundle: let $\{F_j\}$ be local equations for $C$, then $\{f/F_j^k\}_j$ gives (for the right natural number $k$) a non zero section of $[-C]\vert_C=N^*_{C,M}$ (the conormal bundle of $C$ in $M$), hence $\deg N_{C,M}<0$, therefore $C\cdot C<0$ (the section vanishes somewhere because of the 2nd hypothesis).
What if $C$ is singular?
NOTE: I believe this is quite a simple matter of knowing the right definitions; I tried to search around and to post this on math.stackexchange (https://math.stackexchange.com/questions/466842/negative-self-intersection-and-section-of-the-conormal-sheaf-for-a-singular-comp) but got no answers.