Why do "throw" and "throw ex" in a catch block behave the same way?
<p>I read that when in a catch block, I can rethrow the current exception using "throw;" or "throw ex;".</p>

<p>From: <a href="http://msdn.microsoft.com/en-us/library/ms182363%28VS.80%29.aspx">http://msdn.microsoft.com/en-us/library/ms182363%28VS.80%29.aspx</a></p>

<p>"To keep the original stack trace information with the exception, use the throw statement without specifying the exception." </p>

<p>But when I try this with</p>

<pre><code>        try{
            try{
                try{
                    throw new Exception("test"); // 13
                }catch (Exception ex1){
                    Console.WriteLine(ex1.ToString());
                    throw; // 16
                }
            }catch (Exception ex2){
                Console.WriteLine(ex2.ToString()); // expected same stack trace
                throw ex2; // 20
            }
        }catch (Exception ex3){
            Console.WriteLine(ex3.ToString());
        }
</code></pre>

<p>I get three different stacks. I was expecting the first and second trace to be the same. What am I doing wrong? (or understanding wrong?)</p>

<p>System.Exception: test
   at ConsoleApplication1.Program.Main(String[] args) in c:\Program.cs:line 13
System.Exception: test
   at ConsoleApplication1.Program.Main(String[] args) in c:\Program.cs:line 16
System.Exception: test
   at ConsoleApplication1.Program.Main(String[] args) in c:\Program.cs:line 20</p>
