Not knowing the law is not a defense. But if you have a receipt you may be able to work something out and get this thing dismissed. Feel free to give me a call if you have any questions.
Unfortunately, not knowing the law isn't a defense. What may come into play though is whether or not the knife is truly illegal or not. Many officers think that a thumb stud or even assisted opening knives are illegal. Not so. The knife has to meet the definition of a switchblade to be illegal under that section.
The second issue is the legality of the search. You don't say (and don't post online) why you were contacted or searched. If the initial contact with you or the search was unlawful, the evidence is subject to being suppressed.
Keep your receipts for the knife since you bought it locally - that may work in your favor. You're absolutely going to need an attorney though.
The above answer is for general information only and is based on the information you posted. Every case is fact dependent, so to get a thorough analysis of your situation, you will need to consult face to face with an attorney licensed to practice in the jurisdiction where the incident took place. Do not conclusively rely on any information posted online when deciding what to do about your case.
The crime is possessing the switchblade, not manipulating it or even being the true owner of it. Moreover, as Mr. Zarabi says, ignorance of its illegality is no defense. I agree with Mr. Zarabi that perhaps your attorney can work something out with the DA, provided you have no prior criminal or juvenile history for violent or weapons possession offenses.
The fact that you did know it was illegal to have a switchblade on you or you never used it or flipped it open will not cause you to have the Misdemeanor Dismissed.
However, there may be issues as to the lack of probable cause to have stop you as well as an illegal search and seizure by the officer to have an experienced criminal defense attorney suppress the evidence against you and have the District Attorne' Office dismiss the Misdemeanor Criminal complaint.
The best course of action would be to consult with an attorney.
Should you like to further discuss your matter, please contact myself.
Richard Grant, Orange County Criminal Attorney
Legal disclaimer: Please note that this answer/response does not constitute legal advice of any kind or manner. It is merely intended to provide general information for purposes to aid the poster in finding answers to the question preseented. This answer/response does not create an attorney-client relationship of any kind or manner.