Did you try googling?
There is an open source project here:
http://sox.sourceforge.net/[
^]
That is the source for a command line utility program that converts between all sorts of audio file formats (including raw to WAV and WAV to MP3 -- but not directly from raw to MP3).
Here's an article describing the use of the utility:
http://www.thegeekstuff.com/2009/05/sound-exchange-sox-15-examples-to-manipulate-audio-files/[
^]
Since it's an open source project you can download the source (which can be compiled for Windows) and use whatever part of it you need.
I imagine it's written in C++ -- but it's going to be a lot easier to link your C# program to some C++ code (native or managed) than it is going to be to write it yourself.