George George

George George

  • NA
  • 778
  • 0

out variable assignment

Jun 15 2008 9:14 PM

Hello everyone,


In my sample below, abcd is out parameter. I think it only reduces the value copy from input parameter of caller (Main), and it does not reduces value copy from instance returned from DateTime.Now to abcd (assignment), correct?

(in more details when we do assignment abcd = DateTime.Now, a new instance will be created, and value copied from DateTime.Now return instance, and making abcd point to the new instance?)

[Code]
        static void Test2(out DateTime abcd)
        {
            abcd = DateTime.Now;
        }

        static void Main(string[] args)
        {
            DateTime abcd;

            Test2(out abcd);

            return;
        }
[/Code]


thanks in advance,
George


Answers (6)