Mono version 2.4.2.3 Fedora Core 11

Couldn't find any references to this, not sure if it's a known bug or not,
but the code below should print:

methodArgs[0] = 3
test = 3

but instead prints:

methodArgs[0] = 4
test = 3

This works correctly in Microsoft.Net, and if I take out the ? in the method
sig it works in Mono.

using System;

namespace ByRefReflectionTest
{
        public class MainClass
        {
                
                public void ByRefTest(ref long? fred)
                {
                        fred = 3;
                }
                
                public static void Main (string[] args)
                {
                        long? test = 4;
                        
                        MainClass m = new MainClass ();
                        
                        object[] methodArgs = new object[] { test };
                        
                        m.GetType().GetMethod("ByRefTest").Invoke(m, 
methodArgs);
                        
                        Console.WriteLine(string.Format ("methodArgs[0] = {0}", 
methodArgs[0]));
                                        
                        m.ByRefTest(ref test);
                        
                        Console.WriteLine(string.Format("test = {0}", test));
                        
                }
        }
}

-- 
View this message in context: 
http://www.nabble.com/MethodInfo.Invoke-and-ByRef-tp25862454p25862454.html
Sent from the Mono - General mailing list archive at Nabble.com.

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to