Theory: First of all you must decide which implied volatility you want. Probably you are looking for the Black and Scholes implied vol. (but one could also caclute Heston implied vols etc)
If we are in a B&S setting one desires to retrieve the implied vol by solving the B&S pricing equation for $\sigma$. Unfortunately there is no analytical solution and you will have to use a numerical root finder.
Delta hedge has already provided some frequently used algorithms. I will also mention Brent's Method here. You will have to decide which one you like best.
In general there are two main criteria you should consider
- numerical stability
- speed
(for more see here)
Implementation in C# - for most algorithms you will find pseudocode online which can be easily translated into C# (see e.g. the one for Newton's Method). Every root finder can be coded up in C#. If you are in a hurry just google "root finder c#" and this will give you some already implemented methods.