In this paper, we show that LCD codes are not equivalent to linear codes over small finite fields. The enumeration of binary optimal LCD codes is obtained. We also get the exact value of LD$(n,2)$ over $mathbb{F}_3$ and $mathbb{F}_4$. We study the bound of LCD codes over $mathbb{F}_q$.