For any unknown reason I have to use verbatim instead of listings.
Note: This issue also appear when using listings but Herbert's answer can fix it. Unfortunately, the trick Herbert used there cannot be applied here. I attempted to use the same trick but it failed as follows.
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\defverbatim[colored]
\Lst
{
\begin{verbatim}
class Foo
{
public static void Main()
{
Console.WriteLine("hello xport");
}
}
\end{verbatim}
}
\begin{frame}{hello xport}
\Lst
\end{frame}
\end{document}

It was compiled by pdflatex and latex->dvips->ps2pdf provided by TeX Live 2010 on Windows 7. And my editor is TeXnicCenter.
Caution:
If you want to try my code above, you must copy them in Edit mode. Copying the code directly from the rendered HTML will make my original tabs changed to spaces. :-)
beamerignores all spaces outsideframes by default. Maybe place the code inside the frame and thefragileoption. – Martin Scharrer Jul 16 '11 at 18:21