The Osgood's lemma in complex analysis says that if $f \colon \mathbb{C}^n \to \mathbb{C}$ a continuous function such that $f|_{L}$ is holomorphic for every complex line $L \subset \mathbb{C}^n$, then $f$ is holomorphic. I wonder if there is the following geometric analogue of Osgood's lemma:
Let $X$ be a complex manifold and $A \subseteq X$ a subset (maybe not too bad, say a submanifold, or maybe it also has some singularities...).
Question. Assume that for every holomorphic curve $C \subset X$ the intersection $A \cap C$ is analytic in $C$ (the latter just means that either $C \subseteq A$ or $A \cap C$ is a discrete set). Is it true that $A$ is analytic?
One can also ask, is it true that if the intersection of $A \subset \mathbb{C}^n$ with every complex line $L \subset \mathbb{C}^m$ is analytic, then $A$ is analytic. I think this question is stronger, i.e. an affirmative answer to it will also imply a positive answer on the first one by considering a Stein cover and arguing locally.
UPD.: Of course I do not assume the test-curves to be closed, since closed holomorphic curves can simply not exist, as many commentators point out. The question is local, so it can be phrased as follows. Let $U$ be a small neighbourhood of $0$ in $\mathbb{C}^n$ and $A \subset U$ a closed subset. Assume that for every holomorphic embedding of a disk $f \colon \Delta \to U$ with $f(0) \in A$ either $f(\Delta) \subseteq A$ or $f(0)$ is an isolated point in $f(\Delta) \cap A$. Is it true that $A$ is analytic?