It's not difficult and more developers should learn to do it; it's a very useful tool to have.
When you install .net, the C# and VB.net compilers are installed as well (these are the same compilers that Visual Studio uses).
0. Open a DOS box; there are at least two ways to do this:
Start|Run cmd
Start|Programs|Accesories|Command prompt
Because I use a DOS box extensively I have it on my Quick launch toolbar
1. Determine which versions of the compiler you have:
<br />C:\>dir /s /b "c:\windows\microsoft.net\framework\csc.exe<br />c:\windows\microsoft.net\framework\v1.1.4322\csc.exe<br />c:\windows\microsoft.net\framework\v2.0.50727\csc.exe<br />c:\windows\microsoft.net\framework\v3.5\csc.exe<br /> <br />C:\><br />
2. Execute the compiler of your choice, specifying your source code as a parameter:
<br />C:\>c:\windows\microsoft.net\framework\v3.5\csc.exe Hello.cs<br />Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1<br />for Microsoft (R) .NET Framework version 3.5<br />Copyright (C) Microsoft Corporation. All rights reserved.<br /><br />C:\><br />
3. Execute the program:
<br />C:\>hello<br />Hello, world!<br /><br />C:\><br />
4. If you do this frequently, you may want to write a BAT file to do this:
<br />C:\>type csc.bat<br />@c:\windows\microsoft.net\framework\v3.5\csc.exe %*<br /><br />C:\><br />
5. And/or add the compiler's directory to the Path environment variable
Start|Settings|Control panel|System|Advanced|Environment variables|System variables|Path|Edit