Did you try googling?
There is an open source project here:
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:
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.