The Python Pygments tool looks like it can do what you want and more. I believe that it supports many languages, including C #.
- A wide range of common markup languages ββand formats are supported.
- Particular attention is paid to details that enhance the quality of the backlight.
- Added support for new languages ββand formats; most languages ββuse simple regular expressions lexical mechanism
- several output formats are available, including HTML , RTF, LaTeX Sequences, and ANSI
- it can be used as a command line tool and as a library
source share